-rw------- 1 rem user 1494 Jul 18 2010 num.php
^ ^ Note read permission for group and other is *not* needed!
** Start of listing of num.php **
Experimenting with using regular expressions in PHP
See PHP source for this
";
$negint = '/^ *-[0-9]+ *$/';
$negintmat = preg_match($negint, $subject);
echo "\$negintmat = $negintmat
";
echo "The string [$subject] is:";
if (0 < $posintmat) {
echo " a positive integer.";
} else if (0 < $negintmat) {
echo " a negative integer.";
} else {
echo " not anything I recognize.";
};
echo "
\n";
}
showWhichMat( " - " );
showWhichMat( " -8 " );
showWhichMat( " 8 " );
?>
Separate associative arrays for GET/POST/COOKIE:
$_POST = '; print_r($_POST);
echo '$_COOKIE = '; print_r($_COOKIE);
?>
PHP also merges GET, POST and COOKIE data into one associative array:
$_REQUEST = '; print_r($_REQUEST);
?>
The IP number
is where your client/browser is located.
Here's a complete dump of $_SERVER:
** End of listing of num.php **