use get_defined_vars () to get an array of variables defined in the current scope and then test against it with array_key_exists ();
Edited by:
if you want the function to check for existence, you must create the same:
function varDefined($name,$scope) {
return array_key_exists($name, $scope);
}
and use them like this in any given area:
$exists = varDefined('foo',get_defined_vars());
Should work in any field.
source
share