Bare with me ... just trying to fill in a few of the gaps in the current documentation.
On 26/05/16 11:49, Fleshgrinder wrote: > $g = new class { public $x; }; > > var_dump(isset($g->x)); // false isset manual entry does not say what happens if $g->x does not exist but the false here could equally be 'does not exist' if unset has been called somewhere? > var_dump(property_exists($g, 'x')); // true or array_key_exists('x', $g) in our consistent style but as has been pointed out we do not have a simple 'exists' ... $g->exists('x') ? along with $g->isinit('x') > var_dump($g->x); // null + E_NOTICE Uninitialized > var_dump(is_null($g->x)); // true + E_NOTICE Uninitialized > var_dump($g->x == null); // true + E_NOTICE Uninitialized > var_dump($g->x === null); // true + E_NOTICE Uninitialized Unless null IS the required initial value? Why should we have to initialize a nullable typed property explicitly? I'm still stuck in the simple model of things where 'x' is expandable so we have the simple generic variable of old (PHP4 days) which now has additional attributes such as accessibility (public etc) and a few special cases of type filtering but is lacking a tidy way of adding the more useful filtering attributes such as constraints and yes typing. properties and associative arrays are simply managed list of these simple variables so why do we need different functions to access them. Within a class isset($x) should mirror isset($this->x) and exists($x) makes sense along with other 'object' related functions, but is there no way to get back to a lot simpler consistent handling of variables ... and a more constructive way to add flexible type constraints. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php