note 119968 added to function.implode

From: Date: Fri, 30 Sep 2016 09:39:52 +0000
Subject: note 119968 added to function.implode
Groups: php.notes 
Request: Send a blank email to php-notes+get-206708@lists.php.net to get a copy of this message
It might be worthwhile noting that the array supplied to implode() can contain objects, provided the objects implement the __toString() method. Example: <?php class Foo { protected $title; public function __construct($title) { $this->title = $title; } public function __toString() { return $this->title; } } $array = [ new Foo('foo'), new Foo('bar'), new Foo('qux') ]; echo implode('; ', $array); ?> will output: foo; bar; qux ---- Server IP: 72.52.91.14 Probable Submitter: 213.61.241.82 ---- Manual Page -- http://php.net/manual/en/function.implode.php Edit -- https://master.php.net/note/edit/119968 Del: integrated -- https://master.php.net/note/delete/119968/integrated Del: useless -- https://master.php.net/note/delete/119968/useless Del: bad code -- https://master.php.net/note/delete/119968/bad+code Del: spam -- https://master.php.net/note/delete/119968/spam Del: non-english -- https://master.php.net/note/delete/119968/non-english Del: in docs -- https://master.php.net/note/delete/119968/in+docs Del: other reasons-- https://master.php.net/note/delete/119968 Reject -- https://master.php.net/note/reject/119968 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206708) next »