Page 1 of 1

Programming 3 "0x0" problem!

PostPosted: Wed Aug 20, 2008 5:05 am
by nuclearhaxor
i'm trying to solve prog 3... and don't know
What's "0x0"??!

$int=0;
$int+= '0x0'.'50';

its is now 80...

$int=0;
$int+= '0x0'.'100';
int is about 256 ...

i don't understand?!?!?

Re: Programming 3 "0x0" problem!

PostPosted: Wed Aug 20, 2008 7:03 am
by leonidas_heaven
I would have helped you but sorry i haven't completed this mission myself...

Have fun and someone will help you..

Re: Programming 3 "0x0" problem!

PostPosted: Wed Aug 20, 2008 11:31 am
by BhaaL
PHP isnt very picky about numbers, strings and other data types.
'0x' in general is a Prefix for hexdecimal numbers in computing.

PHP sees this:
Code: Select all
$number = 12; # thats a number: 12
$string = '0x0' . $number; # thats a string, "0x012"
$int = 0; $int += $string; # $string is converted to integer, $int is now 18 decimal or 0x12 hexdecimal


That should be all you need to solve the rest - probably :P

Re: Programming 3 "0x0" problem!

PostPosted: Thu Aug 21, 2008 3:48 am
by nuclearhaxor
yes thankx a lot =)