Jump to content

something about 08 , 09 and function


fird01

Recommended Posts

 
$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

<?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

<?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..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.