I was wondering if there was a way to retrieve a value of a php variabile in a JSON file.
For example, I have this following JSON file (file.json
):
{
"Hello": "Hello $name"
}
And this PHP file:
<?php
$name = "Rick";
$jsonFile = json_decode("file.json", true);
$hello = $jsonFile["Hello"];
echo $hello;
?>
What if I want to echo Hello Rick
, instead of Hello $name
?
Is it impossibile or is there a way to do it?