note 73512 added to language.oop5.overloading
| From: | j dot stubbs at linkthink dot co dot jp | Date: | Tue, 27 Feb 2007 05:53:21 +0000 |
| Subject: | note 73512 added to language.oop5.overloading | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123916@lists.php.net to get a copy of this message | ||
In reply to james at thunder-removeme-monkey dot net,
Unfortunately it seems that there is no way to have completely transparent array properties with
5.2.x. The code you supplied works until working with built-in functions that perform type-checks:
<?
// Using the same View class
$view = new View();
$view->bar = array();
$view->bar[] = "value";
if (is_array($view->bar))
print "is array!\n"; // Not printed
// Warning: in_array(): Wrong datatype for second argument in ...
if (in_array("value", $view->bar))
print "found!\n"; // Not printed
// Successful
if (in_array("value", (array)$view->bar))
print "found!\n";
?>
It also seems that 5.1.x is no longer maintained as it's not listed on the downloads page..
Quite frustrating. :/
----
Server IP: 69.147.83.197
Probable Submitter: 222.1.99.23
----
Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php
Edit -- https://master.php.net/note/edit/73512
Del: integrated -- https://master.php.net/note/delete/73512/integrated
Del: useless -- https://master.php.net/note/delete/73512/useless
Del: bad code -- https://master.php.net/note/delete/73512/bad+code
Del: spam -- https://master.php.net/note/delete/73512/spam
Del: non-english -- https://master.php.net/note/delete/73512/non-english
Del: in docs -- https://master.php.net/note/delete/73512/in+docs
Del: other reasons-- https://master.php.net/note/delete/73512
Reject -- https://master.php.net/note/reject/73512
Search -- https://master.php.net/manage/user-notes.php