Re: Strange Numeric Conversion...

From: Date: Fri, 02 Apr 2004 22:35:50 +0000
Subject: Re: Strange Numeric Conversion...
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-182208@lists.php.net to get a copy of this message
Thanks Red, but, still the same problem: $id = 000011; $id2 = preg_replace("/^0+(.*)$/","\\1",$id); echo $id2; // Displays 9 echo $id; // Displays 9 as well. If the number begins with a zero, there seems to be no way to tell PHP this is an integer, not an octal. The conversion happens as soon as the number is stored in the variable, it appears, which is why everything done afterwards makes no difference, because $id=000011; seems to be stored as $id=>9 by PHP. > From: redeye@erisx.de (Red Wingate) > Organization: ErisX Development > Reply-To: redeye@erisx.de > Newsgroups: php.general > Date: Sat, 03 Apr 2004 00:01:43 +0200 > To: redeye@erisx.de > Cc: Monty <monty3@hotmail.com>, php-general@lists.php.net > Subject: Re: [PHP] Strange Numeric Conversion... > > sry... it's \\1 instead of //1 ... guess i had one to many beers :) > > Red Wingate wrote: > >> trim will not work, try something like: >> >> $id = preg_replace("/^0+(.*)$/","//1",$id); >> >> instead >> >>

« previous php.general (#182208) next »