title: Weird behavior of matching array keys after json_decode()
body: <p>I've got some very weird behavior in my PHP code. I don't know if this is actually a good SO question, since it almost looks like a bug in PHP. I had this problem in a project of mine and isolated the problem:</p>
  
  <pre><code>// json object that will be converted into an array
  $json = '{"5":"88"}';
  $jsonvar = (array) json_decode($json); // notice: Casting to an array
  // Displaying the array:
  var_dump($jsonvar);
  // Testing if the key is there
  var_dump(isset($jsonvar["5"]));
  var_dump(isset($jsonvar[5]));
  </code></pre>
  
  <p>That code outputs the following:</p>
  
  <pre><code>array(1) {
    ["5"]=&gt;
    string(2) "88"
  }
  bool(false)
  bool(false)
  </code></pre>
  
  <p><b>The big problem:</b> Both of those tests should produce bool(true) - if you create the same array using regular php arrays, this is what you'll see:</p>
  
  <pre><code>// Let's create a similar PHP array in a regular manner:
  $phparr = array("5" =&gt; "88");
  // Displaying the array:
  var_dump($phparr);
  // Testing if the key is there
  var_dump(isset($phparr["5"]));
  var_dump(isset($phparr[5]));
  </code></pre>
  
  <p>The output of that:</p>
  
  <pre><code>array(1) {
    [5]=&gt;
    string(2) "88"
  }
  bool(true)
  bool(true)
  </code></pre>
  
  <p>So this doesn't really make sense. I've tested this on two different installations of PHP/apache.</p>
  
  <p>You can copy-paste the code to a php file yourself to test it.</p>
  
  <p>It must have something to do with the casting from an object to an array.</p>