Result is:
{"plate":"LQT 883","model":"-1584460854"}
Actually I want this value as following:
{"plate":"LQT 883","model":-1584460854}
Here more Code, sorry
echo json_encode(array(
"plate" => $randomString .= $result_4 .= $plate,
"model" => $row['item']
), true);
CodePudding user response:
If you want json_encode()
to encode the value as an integer, you need to cast it as one:
"model" => (int)$row['item']