note 73512 deleted from language.oop5.overloading by danbrown
| From: | danbrown@php.net | Date: | Mon, 20 Jun 2011 15:20:07 +0000 |
| Subject: | note 73512 deleted from language.oop5.overloading by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180739@lists.php.net to get a copy of this message | ||
Note Submitter: j dot stubbs at linkthink dot co dot jp
----
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:
<?php
// 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. :/