jjacquay712 Posted April 11, 2008 Share Posted April 11, 2008 I wrote a script to convert an ip address to binary, but it isnt working, im new to php, so my syntax might be funny. can anyone tell me what might be going wrong? Thanks, John The Error: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\wamp\www\bianary\script1.php on line 11 The Code: <?php if ( $_POST['1'] <= 128 ) { $64 = $_POST['1'] - 128; This line is line 11 on my php document echo "1"; }else { echo "0"; $_POST['1'] = $64; } if ( $64 >= 64 ) { $32 = $64 - 64; echo "1"; } else { echo "0"; $32 = $64; } if ( $32 >= 32 ) { $16 = $32 - 32; echo "1"; } else { echo "0"; $16 = $32; } if ( $16 >= 16 ) { $8 = $16 - 16; echo "1"; } else { echo "0"; $8 = $16; } if ( $8 >= 8 ) { $4$ = 8 - 8; echo "1"; } else { echo "0"; $4 = $8; } if ( $4 >= 4 ) { $2 = $4 - 4; echo "1"; } else { echo "0"; $2 = $4; } if ( $2 >= 2 ) { $1 = $2 - 2; echo "1"; } else { echo "0"; $1 = $2; } if ( $1 >= 1 ) { echo "1"; } else { echo "0"; } ?> Link to comment https://forums.phpfreaks.com/topic/100725-php-binary-converter-help/ Share on other sites More sharing options...
discomatt Posted April 11, 2008 Share Posted April 11, 2008 Variable names can not start with a number. Link to comment https://forums.phpfreaks.com/topic/100725-php-binary-converter-help/#findComment-515172 Share on other sites More sharing options...
jjacquay712 Posted April 11, 2008 Author Share Posted April 11, 2008 THANK YOU SO MUCH!!! Im a retard...lol. ill change the names Link to comment https://forums.phpfreaks.com/topic/100725-php-binary-converter-help/#findComment-515174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.