title: codeigniter using function inside a controller
body: <p>For some reason I cant run the <code>change()</code> function and everything after it stops. I try with <code>$this-&gt;change()</code> but the effect is the same. If I run the function in a php file its working and the num is changing.</p>
  
  <pre><code>class Test extends CI_Controller {
  
      function __construct(){
          parent::__construct();
      }
  
      public function home(){
  
          $num = 1;
  
          change($num);
  
  
          function change($num,$rand=false){
  
              echo 'inside function'; // this is not shown
  
              if($num &lt; 4) {
                  $rand = rand(1,9);
                  $num = $num.$rand;
                  change($num,$rand);
              } else {
                  echo $num;
              }
          }
          echo 'done'; // this is not shown
  
      }
  
  }
  </code></pre>