|
In addition to PHP's built-in functions, you can create your own functions. Remember that if you want to use variables that exist outside of the function, then you must declare them as global variables or assign them as arguments to the function itself. function check_age($age) { if ($age > 21) { return 1; } else { return 0; } } //usage: if(check_age($age)) { echo "You may enter!"; } else { echo "Access Not Allowed!"; exit; } The function would be called from within your script at the appropriate time, using the following syntax: $age = 10; check_age($age); Example: function simpletable($text) { print(""); print("$text | "); print(" "); }
phpinfo( )
phpinfo() is a very useful function that allows you to see what version of PHP is running on your Web server, as well as all of the specific settings that are enabled in that version. phpinfo(); ?> |