Archive for April, 2009
array_flip()
Use an array to create a new array with the original values as keys and the original keys as values. Conflicting “new keys” will overwrite.
method_exists()
Returns true if the method named has been defined for the given class. False otherwise. Returns false if the class has not been declared.
function_exists()
Returns true if the function named has been defined. False otherwise. This looks at the internal (PHP and extension defined) as well as user defined functions.
class_exists()
Determine if a class exists. Pass it a class name and you’ll get true or false if it has been declared or not. Set the second parameter to false if you don’t want it to call __autoload() when checking.
get_declared_classes()
Get a list of the declared classes. This includes classes declared by PHP and any extensions as well as user declared classes for the current script.
get_defined_functions()
Get an array full of the defined functions. This includes the predefined PHP functions, those defined by extensions as well as any user defined ones but not if created with create_function().
get_defined_constants()
Get an array full of the defined constants (name => value). This includes the predefined PHP constants and constants defined by extensions as well as any user defined ones but not any class constants.
get_defined_vars()
Returns an array of all the defined variables of the current scope. The resulting array will have the variable names as keys and their values as the corresponding values.
var_export()
Outputs (prints) the PHP code needed to create the variable given. Set the second parameter to true to have the data returned instead of displayed.
var_dump()
Outputs information about a variable. This will display type, content, and some other applicable data about the variable or variables passed.
