I am very new to the PHP, I am coming from the background of .net. I am trying to make web service which will take parameter from URL and process business logic then output it in jSON.
This is my code
<?php
$data = '';
$Site = $_GET['COUNTRY_SITE'];
$Language = $_GET['LANGUAGE'];
$data = "{\"Site\":" . "\"" . $Site . "\"" . ",\"Language\":" . "\"" . $Language . "\"" . "}";
//header('Content-type: application/json');
//echo $data;
$x = json_decode($data,true);
var_dump($x);
?>
I am getting below output
array(2) {
["Site"]=>
string(5) "India"
["Language"]=>
string(2) "GB"
}
Why I am not getting output like this
{
"Site":"India",
"Language":"GB"
}
Can somebody help me and do explain if possible