php - Warning: json_decode() expects parameter 1 to be string -


i insert php array mysql using json_encodemethod :

["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

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -