Jump to content

[SOLVED] splitting 6 digit number into 3 groups of two.


Yammyguy

Recommended Posts

I have an array value 090413 which is year, month, day.

 

I've tried:

$date = 090413;
list($year, $monthday) = str_split($date, 2);
list($month, $day) = str_split($monthday, 2);
echo"$year <br />$month <br />$day<br />";

 

This sort of works, however the $day variable has no value.

 

anyone know of a more efficient way of splitting this into 3 parts of two a little more directly?

 

Thanks very much in advance!

C.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.