note 75214 added to language.oop5.magic
| From: | AndreaGiammarchi at osu1 dot php dot net | Date: | Fri, 18 May 2007 09:44:02 +0000 |
| Subject: | note 75214 added to language.oop5.magic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126682@lists.php.net to get a copy of this message | ||
I wonder why "Magic" should disappear in this case:
<?php
class DynamicFunction {
private $callback;
function __construct(){
$this->callback = create_function('', 'return "Hello
World!";');
}
function __toString(){
return ''.$this->callback;
}
}
$f = new DynamicFunction();
$s = ''.$f;
echo $s(); // Hello World!
echo $f(); // Fatal Error ...
?>
... it "shouldn't be useful", but why Fatal Error?!?!?!????
Parser should read __toString value and use them as expected (at least in my humil opinion).
----
Server IP: 213.92.11.19
Probable Submitter: 84.220.44.148
----
Manual Page -- http://www.php.net/manual/en/language.oop5.magic.php
Edit -- https://master.php.net/note/edit/75214
Del: integrated -- https://master.php.net/note/delete/75214/integrated
Del: useless -- https://master.php.net/note/delete/75214/useless
Del: bad code -- https://master.php.net/note/delete/75214/bad+code
Del: spam -- https://master.php.net/note/delete/75214/spam
Del: non-english -- https://master.php.net/note/delete/75214/non-english
Del: in docs -- https://master.php.net/note/delete/75214/in+docs
Del: other reasons-- https://master.php.net/note/delete/75214
Reject -- https://master.php.net/note/reject/75214
Search -- https://master.php.net/manage/user-notes.php