PHP Classes

undefined offset notice

Recommend this page to a friend!

      Brainf*** Interpreter  >  All threads  >  undefined offset notice  >  (Un) Subscribe thread alerts  
Subject:undefined offset notice
Summary:It's good to disable notices.
Messages:1
Author:Hamed Afshar
Date:2011-08-20 13:10:56
 

  1. undefined offset notice   Reply   Report abuse  
Picture of Hamed Afshar Hamed Afshar - 2011-08-20 13:10:56
Hi,
It's a nice class, but I found a small issue.
in line 82, there's this line:
$this->stack[$this->pointer]++;

since $this->stack[$this->pointer] is not defined at first, so a notice is displayed by PHP.
By adding the followin lines before the switch block, the problem will be solved:

if (!isset($this->stack[$this->pointer])) {
$this->stack[$this->pointer]=0;
}

:)