Skip to content
Advertisement

I want to emove quote on echo json_encode();

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);

Advertisement

Answer

If you want json_encode() to encode the value as an integer, you need to cast it as one:

"model" => (int)$row['item']
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement