title: Php doesn't break in a recursive foreach loop
body: <p>I have a recursive function like below.</p>
  
  <pre><code>public function findnodeintree($cats,$cat_id)
  {       
      foreach($cats as $node)
      {                   
          if((int)$node['id'] == $cat_id)
          {       
              echo "finded";
              $finded = $node;
              break;
          }
          else
          {
              if(is_array($node) &amp;&amp; array_key_exists('children', $node)){ 
                  $this-&gt;findnodeintree($node['children'],$cat_id);
              }
          }           
      }
      return $finded;
  }
  </code></pre>
  
  <p>For Example</p>
  
  <pre><code>$node =$this-&gt;findnodeintree($category_Array, 169);
  </code></pre>
  
  <p>It gaves me </p>
  
  <pre><code>"founded"
  </code></pre>
  
  <p>A PHP Error was encountered</p>
  
  <pre><code>Severity: Notice
  
  Message: Undefined variable: finded
  </code></pre>
  
  <p>Array Structure is like </p>
  
  <pre><code>    [0] =&gt; Array
      (
          [id] =&gt; 0
          [name] =&gt; MAIN CATEGORY
          [depth] =&gt; 0
          [lft] =&gt; 1
          [rgt] =&gt; 296
          [children] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [id] =&gt; 167
                          [name] =&gt;  CAT 0
                          [depth] =&gt; 1
                          [lft] =&gt; 2
                          [rgt] =&gt; 17
                          [children] =&gt; Array
                              (
                                  [0] =&gt; Array
                                      (
                                          [id] =&gt; 169
                                          [name] =&gt;   CAT 1
                                          [depth] =&gt; 2
                                          [lft] =&gt; 3
                                          [rgt] =&gt; 4
                                      )
  
                                  [1] =&gt; Array
                                      (
                                          [id] =&gt; 170
                                          [name] =&gt;   CAT 2
                                          [depth] =&gt; 2
                                          [lft] =&gt; 5
                                          [rgt] =&gt; 10
                                          [children] =&gt; Array
                                              (
                                                  [0] =&gt; Array
                                                      (
                                                          [id] =&gt; 171
                                                          [name] =&gt;    CAT 5
                                                          [depth] =&gt; 3
                                                          [lft] =&gt; 6
                                                          [rgt] =&gt; 7
                                                      )
  
                                                  [1] =&gt; Array
                                                      (
                                                          [id] =&gt; 172
                                                          [name] =&gt;    CAT 3
                                                          [depth] =&gt; 3
                                                          [lft] =&gt; 8
                                                          [rgt] =&gt; 9
                                                      )
  
                                              )
  
                                      )
  </code></pre>