<?php class bar implements ArrayAccess { public $fields = []; /** * __construct * * @param mixed $eventInfo * @return void */ public function __construct($eventInfo) { // parent::__construct(); foreach ($eventInfo as $name => $value) { $this[$name] = $value; } } /** * getId * * @return void */ public function getId() { return $this; } /** * offsetExists * * @param mixed $name * @return void */ public function offsetExists($name) { return isset($this->fields[$name]); } /** * offsetGet * * @param mixed $name * @return void */ public function offsetGet($name) { return isset($this->fields[$name]) ? $this->fields[$name] : null; } /** * offsetSet * * @param mixed $name * @param mixed $value * @return void */ public function offsetSet($name, $value) { $this->fields[$name] = $value; } /** * offsetUnset * * @param mixed $name * @return void */ public function offsetUnset($name) { unset($this->fields[$name]); } } $eventInfo = ["name" => "A", "type" => "Programmer", "action" => "success"]; print_r((new bar($eventInfo))->getId());
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`