<?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));
Warning: Undefined variable $pages in /in/MQMgP on line 12
Deprecated: Creation of dynamic property Record::$ is deprecated in /in/MQMgP on line 12
Warning: Undefined array key 0 in /in/MQMgP on line 18
NULL
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Warning: Undefined variable $pages in /in/MQMgP on line 12
Warning: Undefined array key 0 in /in/MQMgP on line 18
NULL
Notice: Undefined variable: pages in /in/MQMgP on line 12
Notice: Undefined offset: 0 in /in/MQMgP on line 18
NULL
Output for 7.3.32 - 7.3.33
NULL
Output for 7.0.0 - 7.0.33
Notice: Undefined variable: pages in /in/MQMgP on line 12
Fatal error: Uncaught Error: Cannot access empty property in /in/MQMgP:12
Stack trace:
#0 /in/MQMgP(23): Record->addRecord('t', 'm')
#1 {main}
Next Error: Cannot access empty property in /in/MQMgP:12
Stack trace:
#0 /in/MQMgP(23): Record->addRecord('t', 'm')
#1 {main}
thrown in /in/MQMgP on line 12
Process exited with code 255.
Notice: Undefined variable: pages in /in/MQMgP on line 12
Fatal error: Cannot access empty property in /in/MQMgP on line 12
Process exited with code 255.