I try to decode a string with json_decode()
function.
$in = $_POST['json'];
$jsonIn = json_decode($in);
for example
$in = '{"company":"q","address":"q","phone":"q","mobile":"q","email":"q"}';
if I try to force the raw string, it works fine, but if I use $in instead, it doesn't
the proof that it does / doesn't is the fact that if I try to access for example
$jsonIn->company
in the first case it returns me null
, in the second one it returns me "q"
.
anybody can explain? thanks in advance Dario