3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Record { private $index=0; //page index private $pages=[]; //pages array public function nextPage() { $this->index++; } public function addRecord($key, $value) { $this->$pages[$this->index][$key] = $value; } public function getPage($index) { if ($index > $this->index) return NULL; else return $this->pages[$this->index]; } } $r = new Record(); $r->addRecord("t","m"); var_dump($r->getPage(0));

preferences:
57.35 ms | 402 KiB | 5 Q