PHP loop through arrayObject -


this first time work arrayobjects maybe didn't understand 100% please explain me how loop through them? code

$this->plugins = new \arrayobject(array()); //just testing... $this->plugins->plugin1 = "plugin1"; $this->plugins->plugin2 = "plugin2"; $this->plugins->plugin3 = "plugin3";  foreach ($this->plugins $plugin){      //never reached } 

$this->plugins->count() returns 0 , $this->plugins->getiterator()->valid(); returns false well. have do?

you have gotten far how works

// can have array $array = array('buck','jerry','tomas');  $arrayobject = new arrayobject($array); // add new element $arrayobject->append('tweety');  // getting iterator of object $iterator = $arrayobject->getiterator();  // simple while loop while ($iterator->valid()) {     echo $iterator->current() . "\n";     $iterator->next(); } 

source


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -