note 76054 added to language.oop5.magic
| From: | mark_sal at osu1 dot php dot net | Date: | Thu, 28 Jun 2007 03:35:11 +0000 |
| Subject: | note 76054 added to language.oop5.magic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128040@lists.php.net to get a copy of this message | ||
un caso en donde se trata de imprimir un objeto con valores array, atraves del método echo.
<?php
class TestClass
{
public $foo = array();
public function funcion_ejemplo($foo) {
$this->foo = $foo;
}
public function __toString() {
if(!is_array($this->foo)){
return $this->foo;
}
else {
print_r($this->foo);
return '';
}
}
}
$class = new TestClass();
$class->funcion_ejemplo( array( '0', '1', '2', '3',
'4', '5' ,'6' ) );
echo $class;
?>
----
Server IP: 201.216.232.3
Probable Submitter: 190.136.169.43
----
Manual Page -- http://www.php.net/manual/en/language.oop5.magic.php
Edit -- https://master.php.net/note/edit/76054
Del: integrated -- https://master.php.net/note/delete/76054/integrated
Del: useless -- https://master.php.net/note/delete/76054/useless
Del: bad code -- https://master.php.net/note/delete/76054/bad+code
Del: spam -- https://master.php.net/note/delete/76054/spam
Del: non-english -- https://master.php.net/note/delete/76054/non-english
Del: in docs -- https://master.php.net/note/delete/76054/in+docs
Del: other reasons-- https://master.php.net/note/delete/76054
Reject -- https://master.php.net/note/reject/76054
Search -- https://master.php.net/manage/user-notes.php