it sure is, because you never change the value of $guess so the while clause is never met.
Do you want to use "do"? If so use $guess-- or $guess++
However I suspect you could just have
if ($guess > $number) $text = "guess is too high, try again";
else if ($guess < $number) $text = "guess is too low, try again";
else $text = "congratulations";
echo $text;
and you will only get one bit of text returned.