I’m having a difficult time returning an array in my __toString method.
Here is my code.
public function __toString()
{
$this->_libraries();
$this->_sysConfig();
//print_r($this->version);
$version = implode("\n", $this->version);
echo $version;
return 'echo';//$version;
}
I have been playing around with it but no mater what I do I still get this error
Notice: Array to string conversion in (...)
Is it not possible to return an array?
this is the array i am trying to implode
Array
(
[0] => Array
(
[version] => Array
(
[item] => Array
(
[0] => Array
(
[name] => cms
[version] => 1.0
)
[1] => Array
(
[name] => TinyMCE Jquery Package
[version] => 3.5
)
[2] => Array
(
[name] => Jquery
[version] => 1.7.2
)
)
)
)
)
You can not use
implodeon a multi dimensional arrayExample
Output
Demo 1
Output
Demo 2
Output
Function Used