Webmaster
| |
| define(constant_name, value, case_insensitive) | |
| Defines a named constant. You first declare a name and then the value it represents. If you don't want the name to be defined as case-sensitive, which is the default option, you have to specify the third parameter, case_insensitive, in the form of the TRUE boolean value. If the constant cannot be created for whatever reason or error, the result of the function will be FALSE (0). | |
| Example | <? define("COOKED", "Switch off the oven"); ?> |
| defined(constant) | |
| If the named constant has already been defined, the function results will be TRUE (1), otherwise it is FALSE (0). | |
| Example | <? define("COOKED","Switch off the oven"); if(defined("COOKED")) { print("The constant exists."); } ?> |
| doubleval(variable) | |
| Returns the float value of the variable. In any case, the result is a double. | |
| Example | <? $doublevar = "25 inch"; print(doubleval($doublevar)); ?> |
| empty(variable) | |
| Used to determine if a variable has been set. The function result is TRUE if the variable has not received any value or has been assigned 0. | |
| Example | <? if(empty($townvar)) { print("Unknown town"); } else { print("The name of the town is known."); } ?> |
| get_meta_tags(filename) | |
| Extracts all meta tag content attributes contained in the file referred to by the argument. In the array returned by the function, the properties declared with the name attribute become element keys and the corresponding content attribute values become element values. | |
| Example | <HTML> <HEAD> <TITLE>Meta example</TITLE> <META name="description" content="Description to be indexed in a PHP array"> </HEAD> <BODY> <? get_meta_tags("filename.php"); ?> </BODY> </HTML> |
| gettype(variable) | |
| Returns a character string that gives the argument's data type. The following are the main strings that can be returned: integer, double, string, array, object, class, or unknown type. | |
| Example | <? printf("%s <br>\n", gettype("Hi")); printf("%s <br>\n", gettype(12)); printf("%s <br>\n", gettype(8.3)); ?> |
| intval(variable) | |
| Returns the integer value of the argument. | |
| Example | <? $numstring = "25.8"; intval($numstring); ?> |
| is_array(variable) | |
| The function's result is TRUE if the argument is an array. | |
| Example | <? $frenchflag = array("blue", "white", "red"); if(is_array($frenchflag)) { print("This is indeed an array."); } ?> |
| is_double(variable) | |
| Ascertains whether the passed argument is a floating point number, in which case the function's result is TRUE. | |
| Example | <? is_double(20.78); ?> |
| is_integer(variable) | |
| Ascertains whether the passed argument is an integer, in which case the function's result is TRUE. | |
| Example | <? is_integer(2078); ?> |
| is_object(variable) | |
| Ascertains whether the passed argument is an object, in which case the function's result is TRUE. | |
| Example | <? class Objectstruct { var $name; } $objref = new Objectstruct; if(is_object($objref)) { print("This is indeed an object."); } ?> |
| is_string(variable) | |
| Ascertains whether the passed argument is a string, in which case the function's result is TRUE. | |
| Example | <? is_string($author); ?> |
| is_type(variable, type) | |
| The function's result is TRUE if the type of the first argument matches the type given as the second argument. There are six types available: integer, double, string, array, object et class. | |
| Example | <? is_type("hello", "string") ?> |
| isset(variable) | |
| Ascertains whether a variable has been assigned a value, in which case the function's result is TRUE. | |
| Example | <? isset($var) ?> |
| settype(variable, type) | |
| Converts the first argument's type to the type specified by the second argument. The function is TRUE if the conversion is successful. Here are the types available as the second argument: array, double, integer, object, string. | |
| Example | <? settype(20.78, "integer"); ?> |
| strval(variable) | |
| Converts the argument's value into its string equivalent. | |
| Example | <? strval(875241); ?> |
| unset(variable) | |
| Destroys the variable passed as the argument in order to free the memory. | |
| Example | <? unset($var); ?> |
| |