Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's a technique called recursion. This particular function descends into the structure until it is dealing with very simple data and sanitizes it all. </p> <p>Given this:</p> <pre><code>$arr = array ( '&lt;foo' =&gt; array( 'bat' =&gt; 'OMGWTFBBQ!!&gt;&lt;!?!' ), 'bar' =&gt; 'baz' ); </code></pre> <p>It would start:</p> <ol> <li>is arr an array? <ol> <li>is <code>&lt;foo</code> an array? (no) <ul> <li><code>&lt;foo</code> becomes <code>&amp;lt;foo</code></li> <li><code>&amp;lt;foo</code> used as a key</li> </ul></li> <li>is the value of <code>&lt;foo</code> an array? (yes) <ol> <li>Is bat an array? (no) <ul> <li><code>bat</code> remains as is (still has htmlspecialchars called, but it does not change anything))</li> </ul></li> <li>Is <code>'OMGWTFBBQ!!&gt;&lt;!?!'</code> an array (no)? <ul> <li><code>'OMGWTFBBQ!!&gt;&lt;!?!'</code> is converted to <code>'OMGWTFBBQ!!&amp;gt;&amp;lt;!?!'</code></li> <li><code>'OMGWTFBBQ!!&amp;gt;&amp;lt;!?!'</code> is used for the value for bat.</li> </ul></li> </ol></li> <li>Is 'bar' an array? (no) <ol> <li><code>bar</code> returned as is (like bat above)</li> <li>Is baz an array? (no) <ul> <li><code>baz</code> returned as is.</li> </ul></li> </ol></li> </ol></li> </ol> <p>You can think of it this way</p> <pre><code>$arr = array ( '&lt;foo' =&gt; array( 'bat' =&gt; 'OMGWTFBBQ!!&gt;&lt;!?!' ), 'bar' =&gt; 'baz' ); /////////////////////////////////////////// array ( clean('&lt;foo') =&gt; array( 'bat' =&gt; 'OMGWTFBBQ!!&gt;&lt;!?!' ), 'bar' =&gt; 'baz' ); /////////////////////////////////////////// array ( '&amp;lt;foo' =&gt; clean( array( 'bat' =&gt; 'OMGWTFBBQ!!&gt;&lt;!?!' )), 'bar' =&gt; 'baz' ); /////////////////////////////////////////// array ( '&amp;lt;foo' =&gt; array( clean( 'bat' ) =&gt; 'OMGWTFBBQ!!&gt;&lt;!?!' )), 'bar' =&gt; 'baz' ); /////////////////////////////////////////// array ( '&amp;lt;foo' =&gt; array( 'bat' =&gt; clean( 'OMGWTFBBQ!!&gt;&lt;!?!' ) )), 'bar' =&gt; 'baz' ); /////////////////////////////////////////// array ( '&amp;lt;foo' =&gt; array( 'bat' =&gt; 'OMGWTFBBQ!!&amp;gt;&amp;lt;!?!' )), clean( 'bar' ) =&gt; 'baz' ); /////////////////////////////////////////// array ( '&amp;lt;foo' =&gt; array( 'bat' =&gt; 'OMGWTFBBQ!!&amp;gt;&amp;lt;!?!' )), 'bar' =&gt; clean( 'baz' ) ); /////////////////////////////////////////// return array ( '&amp;lt;foo' =&gt; array( 'bat' =&gt; 'OMGWTFBBQ!!&amp;gt;&amp;lt;!?!' )), 'bar' =&gt; 'baz' ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload