title: Does PHP automatically convert numbers to strings?
body: <p>I am using dojo and ajax to send a time stamp to PHP, which does a database check, then returns  the time stamp for debugging purposes. When I send this time stamp, it's a number, when it is returned, it is a string. Is there a specific reason for this? What should I do to avoid this (cast to int in PHP, fix via JSON, or cast to int in javascript)</p>
  
  <p>Here is the Dojo code</p>
  
  <pre><code>dojo.xhrGet({
   url: 'database/validateEmail.php',
   handleAs: "json",
   content: {
   email : 'George.Hearst@Pinkerton.dw',
   time: 0
   },
   load: function(args) {/*SEE BELOW*/}
  });
  </code></pre>
  
  <p>Here is the PHP script</p>
  
  <pre><code>&lt;?php
  
  /**
   ** connect to the MySQL database and store the return value in $con
   *
   */
  $con = mysql_pconnect("localhost:port", "username", "password");
  
  /**
   ** handle exceptions if we could not connect to the database
   *
   */
  if (!$con) {
      die('Could not connect: ' . mysql_error());
  }
  
  /**
   ** Create table query
   *
   */
  mysql_select_db("portal", $con);
  
  /**
   ** Get user entered e-mail
   *
   */
  $emailQuerry = mysql_num_rows(mysql_query("SELECT EMAIL FROM user WHERE EMAIL='" . $_GET["email"] . "'")) == 1;
  
  /**
   ** Whether successful or not, we will be returning the time stampe (this is used to determine whether there were any changes between the time a request
   ** was sent, and when this response was returned.
   *
   */
   $result['time'] = $_GET["time"];
  
  /**
   ** Currently only checks to see if the two values were provided. Later, will have to check against passwords
   *
   */
  if ($emailQuerry) {
      $result['valid'] = true;
  }
  else {
      $result['valid'] = false;
  }
  
  echo json_encode($result);
  ?&gt;
  </code></pre>
  
  <p>And finally the load function left blank above</p>
  
  <pre><code>load: function(args) {
   console.log(localArgs.time + ' v ' + args.time);
   console.log(localArgs.time === args.time);
   console.log(localArgs.time == args.time);
  }
  </code></pre>
  
  <p>The output of which is </p>
  
  <pre><code>0 v 0
  false
  true
  </code></pre>