- Forums
- PHP
- What Does 'illegal String Offset' Mean In PHP Warning Error?
this page will show you by example what you are doing to generate this error from php that says 'Illegal string offset in your PHP code [8706], Last Updated: Sat May 18, 2024
php
Wed Dec 31, 1969
2 Comments
862 Visits
are you getting an error or warning on your PHP page, so what does this error mean?
Warning: Illegal string offset 'MyArray' in htdocs/test.php on line 5this is what i had on my code on line 5
<?php
function SomeFunction($MyArray){
return;
}
echo SomeFunction($MyArray['name']);
?>
as you can see im calling a function which needs an array, and instead i am pushing only one element of the array instead of the whole array. so to fix this just change line 5 to this:
echo SomeFunction($MyArray);
hope that helps
Best Regards,
Ali