PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
// a ! in front of an expression is a ngeation (NOT)
if (!isset($_REQUEST['beer']))
{
echo 'No beer has been selected, I''ll go for my usual!<br>';
$beer = 'Sam Adams';
}
else
{
$beer = stripslashes($_REQUEST['beer']);
}
echo 'My choice of beer is '.$beer.'!<br>'."\n";
# If the variable was never assignes, isset() returns false
# Just as useful is empty() that returns false if not assigned or if value is zero ir an empty string
?>
intval simply returns the integer part of a string or float (or any other with a numeric in it)