title: Duplicating PHPs function isset
body: <p>I've been using a custom <code>__isset()</code> function already for a long time, which basically only exists to make the code look better and saves time typing:</p>
  
  <pre><code>function __isset(&amp;$aVariable, $aDefault = null) {
      return isset($aVariable) ? $aVariable : $aDefault;
  }
  </code></pre>
  
  <p>But today I found out that this function is actually creating the variable if it doesn't exist! And this is a huge problem when you are checking for array properties:</p>
  
  <pre><code>$lArray = ('A', 'B', 'C');
  $lValue = __isset($lArray[4], 'D');
  print_r($lArray); // Outputs 0=&gt;'A', 1=&gt;'B', 2=&gt;'C', 3=&gt;NULL
  </code></pre>
  
  <p>So what I want is to duplicate the current <code>isset()</code> function from PHP and change it to do what I want. The problem is that I cannot find the actual <code>isset()</code> function in the PHP source code...</p>
  
  <p>A lot of frameworks are using an <code>isset()</code> function like I showed in first example, and I cannot image that I'm the first one who bump into this problem.</p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li>Where can I find the actual <code>isset()</code> PHP function?</li>
  <li>Where can I find the actual <code>isset()</code> C function (the real implementation)?</li>
  <li>How to change the code so that it returns the value, or the specified default value?</li>
  </ol>