Hello all
I need help with a function. I would like a function that tests the string length. IF this length is 4 intergers long I would like to add a '0' in front. Any help would be appreciated.
Tracy
string length
if you are using strings then you might be able to use strlen() funtion and then add something in front with this
http://www.zend.com/manual/language.operators.string.php
I hope this helps you
Thanks Trey!
Function convert ($id){
if (strlen($id)==4){
$id="0".$id;
return $id;
}
}
Is this only if it's 4 long? If you were just looking to pad the string with zeros, you could use [man]str_pad[/man]...
Your welcome. anytime