Here is a variable and it's output is following :
$a = [2, 3, 4];
echo implode(',', $a);
Output
2,3,4
And
I have a class with a php magic method __call
class MagicMethod {
public function __call ( $pm, $values ) {
echo "there is not <b>$pm</b> method <br/> and arguments are <br/>";
echo implode(',', $values);
}
}
$magic = new MagicMethod;
$magic->notExist( [2, 3, 54] );
Now it's showing me error message :
Notice: Array to string conversion in
Why is the __call method getting array data?
echothe array, which then results in the "Array to string conversion..."$values[0].... useecho implode(',', $values[0]);inside your__call()methodimplode()function needarraydata of it's 2nd arguments and I did it !!implodefunction !