I need to do this: There is a config
"test": { "x": "120", "y": "50", "size": "20", "color": "#FFAA00", "text": "Цена {$values}" } I need to when I called $config['test'][text] , output: Price ... (variable value)
need to display the value of the $ values ​​variable
Use the concatenation operator (dot) :
$values = '123'; $json = '{"test": { "x": "120", "y": "50", "size": "20", "color": "#FFAA00", "text": "Цена ' . $values . '" }}'; $config = json_decode($json, true); echo $config['test']['text']; // Цена 123 Цена ' . $valute . ' does Цена ' . $valute . ' Цена ' . $valute . ' Цена ' . $valute . ' - I. Ageyev 5:06Source: https://ru.stackoverflow.com/questions/859102/
All Articles
json_decode- the second parameter of the function if you put intrueyou will have an array. - And