note 104092 added to function.isset
| From: | PaulLashbrook at osu1 dot php dot net | Date: | Sun, 22 May 2011 13:02:50 +0000 |
| Subject: | note 104092 added to function.isset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179939@lists.php.net to get a copy of this message | ||
a correction to the below comment.
if you use the __isset() method within the class you can use the isset() function in your code
still.
<?php
class T
{
function __isset($att)
{
$props = get_object_vars($this);
return array_key_exists($att, $props);
}
}
$x = new T();
$x->foo_exists = 4;
var_dump(isset($x->foo_exists)); // TRUE
var_dump(isset($x->bar_exists)); // FALSE
?>
----
Server IP: 69.147.83.197
Probable Submitter: 81.174.159.247
----
Manual Page -- http://www.php.net/manual/en/function.isset.php
Edit -- https://master.php.net/note/edit/104092
Del: integrated -- https://master.php.net/note/delete/104092/integrated
Del: useless -- https://master.php.net/note/delete/104092/useless
Del: bad code -- https://master.php.net/note/delete/104092/bad+code
Del: spam -- https://master.php.net/note/delete/104092/spam
Del: non-english -- https://master.php.net/note/delete/104092/non-english
Del: in docs -- https://master.php.net/note/delete/104092/in+docs
Del: other reasons-- https://master.php.net/note/delete/104092
Reject -- https://master.php.net/note/reject/104092
Search -- https://master.php.net/manage/user-notes.php