Programming 3 "0x0" problem!

Put your programming skills to the test in these challenges.

Programming 3 "0x0" problem!

Post by nuclearhaxor on Wed Aug 20, 2008 5:05 am
([msg=10111]see Programming 3 "0x0" problem![/msg])

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?!?!?
nuclearhaxor
New User
New User
 
Posts: 7
Joined: Mon Apr 14, 2008 4:07 pm
Blog: View Blog (0)


Re: Programming 3 "0x0" problem!

Post by leonidas_heaven on Wed Aug 20, 2008 7:03 am
([msg=10114]see Re: Programming 3 "0x0" problem![/msg])

I would have helped you but sorry i haven't completed this mission myself...

Have fun and someone will help you..
Challenges are not meant to be taken easily,rather they are meant to be taken Seriously
leonidas_heaven
Experienced User
Experienced User
 
Posts: 66
Joined: Sun Jun 01, 2008 5:20 am
Location: Uttarakhand,India
Blog: View Blog (0)


Re: Programming 3 "0x0" problem!

Post by BhaaL on Wed Aug 20, 2008 11:31 am
([msg=10123]see Re: Programming 3 "0x0" problem![/msg])

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
BhaaL
Poster
Poster
 
Posts: 270
Joined: Sun Apr 13, 2008 11:16 am
Blog: View Blog (0)


Re: Programming 3 "0x0" problem!

Post by nuclearhaxor on Thu Aug 21, 2008 3:48 am
([msg=10179]see Re: Programming 3 "0x0" problem![/msg])

yes thankx a lot =)
nuclearhaxor
New User
New User
 
Posts: 7
Joined: Mon Apr 14, 2008 4:07 pm
Blog: View Blog (0)



Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron