Variable Functions

Aug 29, 2010 Author: Jenna

This section contains functions that work with variables.

empty
Tests whether the variable specified is empty.
Format: $bool = empty($varname);

get_defined_classes
Creates an array containing the names of all the classes in the script, including those in included files.
Format: $array_classes = get_defined_classes();

get_defined_constants
Creates an associative array of all the constants.
Format: $array_constants = get_defined_constants();

get_defined_functions
Creates an array with names of all functions.
Format: $array_functions = get_defined_functions();

get_defined_vars
Creates an array of all variables.
Format: $array_vars = get_defined_vars();

isset
Checks whether variable is set.
Format: $bool = isset($varname);

print_r
Outputs contents of a variable.
Format: print_r($varname);

putenv
Sets an environmental variable as specified by setting. setting is usually name=value.
Format: putenv(“setting”);

serialize
Converts data into a string containing binary data. Used to store data in a file or database. The specified variable can be any type, including an object or a function.
Format: $string_ser = serialize($variable);

unserialize
Converts serialized data back to its original form.
Format: $variable = unserialize($string_ser);

unset
Removes a variable.
Format: unset($varname);

var_dump
Outputs contents of a variable.
Format: var_dump($varname);


views 4340
  1. Add New Comment