php - Warning: json_decode() expects parameter 1 to be string -
i insert php array mysql using json_encode
method :
["11","10","4"]
now need convert php array:
$me = ["11","10","4"]; $you = json_decode($me, true); echo $you;
but in result see : warning: json_decode() expects parameter 1 string, array given in c:\xampp\htdocs\test\test.php on line 5
how fix this?!
your problem $me
isn't string. should encapsulate in single-quotes change this.
$me = '["11","10","4"]'; $you = json_decode($me); print_r($you); // becasue php array, // copy/paste every time
Comments
Post a Comment