I am struggling a bit to find the correct way of adding a php variable in my json string, with text added just in front of the variable. This is what I have got so far...
$postData = '
{
"message": "Web order '.$order_number.'"
}
';
When I look at the printout there is a line break just after "Web order", but otherwise nothing seems to go wrong... is this the way to do it?
json_decodethen add whatever you want to add in the object/array(depending if you decoded it as an object or as an array) then re-encode it.json_encode(array('message'=>"Web order ".$order_number))$order_numbercontains a value that can be cast to string?