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

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

javascript - Handling constructor related functions while testing with mocha and sinon -