Edit report at https://bugs.php.net/bug.php?id=65652&edit=1

 ID:                 65652
 Updated by:         ahar...@php.net
 Reported by:        kozak at eurosat dot cz
 Summary:            isset alternative
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   ALL
 PHP Version:        5.5.3
 Block user comment: N
 Private report:     N

 New Comment:

It's an unusual enough need that I think the get_defined_vars() solution posted 
in the previous comment is good enough.


Previous Comments:
------------------------------------------------------------------------
[2013-09-11 17:45:31] anon at anon dot anon

echo array_key_exists('b', get_defined_vars()) ? "exists" : "doesn't exist";

------------------------------------------------------------------------
[2013-09-11 12:34:01] kozak at eurosat dot cz

Description:
------------
At the moment isset call return true only when variable is set and it is not 
null.

But there is no way (or I do not find it so far), how to just test variable for 
existance. So it will be perfect if there will be some other call (for eg: 
exist) 
or some parametr how to get this behaviour
More in example. 

Test script:
---------------
$a = null;
$testOnlyExistence = true;

echo isset($b); // prints false;
echo isset($a); // prints false;
echo isset($a, $testOnlyExistence); // prints true;
echo isset($b, $testOnlyExistence); // prints false;
// or
echo exist($a); // prints true;
echo exist($b); // prints false;



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65652&edit=1

Reply via email to