note 93044 added to language.exceptions.extending
| From: | ashleyatls12styledotcodotuk at osu1 dot php dot net | Date: | Thu, 20 Aug 2009 13:19:57 +0000 |
| Subject: | note 93044 added to language.exceptions.extending | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159690@lists.php.net to get a copy of this message | ||
In response to paragdiwan at gmail dot com and their example.
You do not need to echo $e->__toString(); You simply need to echo
$e as the __toString method tells php what to do when the object is echo'ed.
for example:
<?php
class a
{
public $b;
public function __construct ($string)
{
$this->b = $string;
}
public function __toString ()
{
return $this->b;
}
}
$a = new a('hello');
echo $a;
//outputs "hello"
?>
----
Server IP: 92.48.74.199
Probable Submitter: 90.152.22.26
----
Manual Page -- http://www.php.net/manual/en/language.exceptions.extending.php
Edit -- https://master.php.net/note/edit/93044
Del: integrated -- https://master.php.net/note/delete/93044/integrated
Del: useless -- https://master.php.net/note/delete/93044/useless
Del: bad code -- https://master.php.net/note/delete/93044/bad+code
Del: spam -- https://master.php.net/note/delete/93044/spam
Del: non-english -- https://master.php.net/note/delete/93044/non-english
Del: in docs -- https://master.php.net/note/delete/93044/in+docs
Del: other reasons-- https://master.php.net/note/delete/93044
Reject -- https://master.php.net/note/reject/93044
Search -- https://master.php.net/manage/user-notes.php