fird01 Posted June 19, 2008 Share Posted June 19, 2008 $a=testme(08,09); echo $a; function testme($a,$b){ $c=$a+$b; return $c; } theres something about 08, 09 and function because that code will output 0.. but if u change the input to 9 and 8 or 01 to 07 instead of 09 and 08 the correct out put will be produce.. so what am i doing wrong here.. is it my apache or ??? and why does function convert number from 01 to 1 or 03 to 3 . how do i maintain the 01 and 02 when passing the data to function.. cause im doing a query with those value.. so 1 is different from 01 when you do a select statement.. Link to comment https://forums.phpfreaks.com/topic/110862-something-about-08-09-and-function/ Share on other sites More sharing options...
Stephen Posted June 19, 2008 Share Posted June 19, 2008 I'm not sure why it does that, but to keep the 0 at front it needs to be a string. Link to comment https://forums.phpfreaks.com/topic/110862-something-about-08-09-and-function/#findComment-568804 Share on other sites More sharing options...
fird01 Posted June 19, 2008 Author Share Posted June 19, 2008 ok that solve the 0 thing ... string it.. i'm still figuring out y the 08 ,09 and function thing turn out to be like that.. Link to comment https://forums.phpfreaks.com/topic/110862-something-about-08-09-and-function/#findComment-568807 Share on other sites More sharing options...
Barand Posted June 19, 2008 Share Posted June 19, 2008 <?php echo 011; // --> 9 octal echo 11; // --> 11 decimal echo 0x11; // --> 17 hexadecimal ?> putting 0 at start makes it an octal number, only digits 0-7 allowed Link to comment https://forums.phpfreaks.com/topic/110862-something-about-08-09-and-function/#findComment-568830 Share on other sites More sharing options...
fird01 Posted June 19, 2008 Author Share Posted June 19, 2008 <?php echo 011; // --> 9 octal echo 11; // --> 11 decimal echo 0x11; // --> 17 hexadecimal ?> putting 0 at start makes it an octal number, only digits 0-7 allowed so how does i not make it think the number that im passing is octal.. Link to comment https://forums.phpfreaks.com/topic/110862-something-about-08-09-and-function/#findComment-568832 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.