0

I want to be able to remove double quotes that in my json_encode:

 $response = array(
        "response" => true,
        "ack_move" => array(
            "slot" => $move,
            "isWin" => false,
            "isDraw" => false,
            "row" => array()
        );
echo json_encode($response);

My result is:

{"response":true,"ack_move":{"slot":"3","isWin":false,"isDraw":false,"row":[]}

I want to remove the double quotes of the integer "3"

How can I do a result is that:

{"response":true,"ack_move":{"slot":3,"isWin":false,"isDraw":false,"row":[]}
Alan
  • 79
  • 11

1 Answers1

2

You could try using function intval($move) to get the integer value, and then assign the value.

http://php.net/manual/en/function.intval.php

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149