Click to See Complete Forum and Search --> : variable changing


Muk108
09-29-2003, 10:18 PM
i have a variable, and i want to be able to take a 4 digit number and insted of having it show up as... XXXX i want it to show up as XX:XX is there a way i can do this and the variable to equal that new form? this is for php.

anfpunk
09-30-2003, 04:24 PM
Not quite sure what you mean by:

"is there a way i can do this and the variable to equal that new form?"


Anyways, here's my guess:


$var = XXXX;
$newvar = substr($var, 0, 2) . ':' . substr($var, 2, 4);


Not sure if you can put all of the $newvar on the same line, but I dont see why not.

Muk108
09-30-2003, 04:56 PM
oh sweet you knew exactly what i was talking about. thank you very much