Re: [PHP] Inserting leading 0 infront of a variable

2002-02-27 Thread Andrey Hristov
This seems an endless loop for me. You do not alter the $myrowp[topic_id] so its length is untouched => if it is <6 you will never get away from the loop. May be you want this. # create topic number 6 digit $count=strlen($myrow[topic_id]) ; while ($count-- < 6){ $leading_digits .= '0'

Re: [PHP] Inserting leading 0 infront of a variable

2002-02-27 Thread Rasmus Lerdorf
$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