This forum is now read-only. Please use our new forums at discuss.codecademy.com.
Introduction to PHP Forum
Why are negative numbers not accepted?
Why isn't this working with negative numbers? Does PHP only know unsigned variables, where all Bits are used for positive numbers?
<?php $myName = "Cyrus"; $myAge = -1; ?>
Error: Did you create a variable called $myAge and set it equal to your age as a number? Don't forget your semicolon!
PHP does work with negative numbers. Just that this exercise is looking for a positive number. Try setting
$myAge = 1;, and it should work. And according to Php.net, "PHP does not support unsigned integers."
I'm not sure why you would say this isn't working. This is perfectly legitimate code (I ran it on my machine to be sure). Did you get an error? Add the line
to your code and it will show "-1" (no quotes).