$leading_digits = '0' . $leading_digits; although what you probably want is strpad() or sprintf()
On Thu, 28 Feb 2002, Andy wrote: > Hi guys, > > is there a possibility to add a string in front of a veriable like the .= > commands adds it to the end? I would like to create a 6 digit number out of > a e.g. 2 digit one. Underneath is my not working code. Maybe someone knows > how to solve that. > > Thanx Andy > > # create topic number 6 digit > while (strlen($myrow[topic_id]) < 6){ > $leading_digits .= '0'; > } > $topic_id = $leading_digits.$myrow[topic_id] ; > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php