php - How can I store string from object as a variable? -


i object in echo $output:

{   "key":"a-string-with-letters-and-numbers" } 

how can store string ("a-string-with-letters-and-numbers") variable, or can echo directly selectors?

i need store string script:

options({   key: "<?php echo $output ?>" }); 

your object not object in php, json string need decode convert in php object or array

 $json  = '{"key":"a-string-with-letters-and-numbers"}';  $object = json_decode($json);  echo $object->key; // object   $array = json_decode($json, true);  echo $array['key']; // array 

Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -