OK, so im messing around with explode function and for some reason i keep getting the error below. Can someone please explain to me, what is happening, what the problem is, and how i can fix it.
Notice: Array to string conversion in /Applications/XAMPP/xamppfiles/htdocs/tutorials/main.php on line 7 Array
<?
$names = 'asdasd asdasdasd sadasdasd asdasdas dasdasd asdasdas d';
$kwame = explode(' ', $names);
echo $kwame;
?>
$kwame
is an array so you can't use echo
to show its contents. You can use print_r()
or var_dump()
:
print_r($kwame);
You can't use echo
with an array. Use print_r()
or var_dump()
to see the contents of an array.
var_dump($kwame);