Welcome Guest, Not a member yet? Register   Sign In
Move array pointer?

Hi guys

I need to move an array pointer from another method.

Here are my codes

class Language extends MY_Controller
   public $fruits = array();

   function __construct()
       $this->fruits = array('apple', 'orange', 'mango', 'banana', 'guyabano');

    //show current array pointer position/value
   public function idx()
       $position = current($this->fruits); // $mode = 'foot';
       echo 'Current index ===> '. $position .'<br>';
    //Move array pointer one step forward
   public function move_idx()

I have a  button called "Next".
When this button was pressed it will call move_idx() method to move the pointer one step forward.

The problemis when I tested this it did not work. 
The pointer did not move one step forward..

Would anyone like to help me?
What's the proper way to do this?

Thanks in advance.

Messages In This Thread
Move array pointer? - by iridion2015 - 04-08-2016, 10:46 PM

Theme © iAndrew 2016 - Forum software by © MyBB