Forum Moderators: coopster

Message Too Old, No Replies

echo 010; = 8?

         

Karma

11:41 am on Jun 18, 2009 (gmt 0)

10+ Year Member



Quick question, can anyone tell me why echo 010; gives a result of 8? Just wondering!

...And no, I'm not having problems echo'ing ints or vars, thanks :)

jatar_k

12:31 pm on Jun 18, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



did you do any other tests?

try these

echo 0100;
echo 01000;

[edited by: jatar_k at 12:42 pm (utc) on June 18, 2009]

coopster

12:33 pm on Jun 18, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That is the decimal equivalent of an octal value.
[php.net...]

Karma

1:11 pm on Jun 18, 2009 (gmt 0)

10+ Year Member



Thanks guys, got it :)

Pico_Train

3:01 pm on Jun 19, 2009 (gmt 0)

10+ Year Member



I think Jatar_K was egging you on. More more!

jatar_k

3:03 pm on Jun 19, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hehe

I was pushing to expand the experiment in such a way that the answer would present itself

coop is often nicer than me ;)

Pico_Train

3:15 pm on Jun 19, 2009 (gmt 0)

10+ Year Member



I didn't realise those examples did that. Never bothered trying. It's interesting to see a the factors of 2 growing. I am going to read the link from Coopster when I get in my occasional daily procrastination mode.