title: PHP - JSON_ENCODE Number converted to string. How to fix it?
body: <p>I have the following variable with some coordinates from google maps:</p>
  
  <pre><code>$coordinates = '(22.2819939, 114.15444100000002)';
  </code></pre>
  
  <p>So to separate them I did the following:</p>
  
  <pre><code>$coor = explode(',',str_replace(array('(',')'),'',$coordinates));
  </code></pre>
  
  <p>Now I need to send this coordinates to an API in the following format:</p>
  
  <pre><code>$message = array("location"=&gt;array($coor[1],$coor[0]));
  </code></pre>
  
  <p>I must send this in json so I encode the array but I am getting the coordinates as strings and not as number:</p>
  
  <pre><code>$toSend = json_encode($message);
  result-&gt; {"location":["114.15444100000002","22.2819939"]}
  </code></pre>
  
  <p>How can I avoid json to take the coordinates as string and take them as number instead?</p>
  
  <p>I need this result:</p>
  
  <pre><code>{"location":[114.15444100000002,22.2819939]}
  </code></pre>