Re: [PHP-WIN] formating a string

2007-05-12 Thread Kevin Smith
The this instead. BTW, you misunderstood the useage of substr, see http://uk.php.net/manual/en/function.substr.php. $code = 'abcdwxyz8765'; $string = array(); array_push($string,substr($code,0,4)); array_push($string, substr($code,4,4)); array_push($string, substr($code,8,4)); echo $string[0].'-

[PHP-WIN] formating a string

2007-05-12 Thread James Savage
i have a 12 digit code that i want to format as follows -- it is all numbers i tried using substr() to format it in this fassion $code = abcdwxyz8765; $string = array(); $string[] = substr($code,1,4); $string[] = substr($code,5,8); $string[] = substr($code9,12); echo $string[0],'-',$st