Actually, you haven't. This line:
$guess = (int) $guess;
casts the value contained in $guess to an integer and then assigns it to the same variable. But where is $guess supposed to have come from before that line?
If you're expecting to access external data (such as that which was sent in the HTML form), then you need to use one of the superglobal arrays ($GET, $POST, etc.). See this manual page for more information: [man]variables.external[/man].