3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace App\Entity; abstract class Entity { protected $repository; protected $transformColumns = []; protected $transformValues = []; protected $properites = []; public function __construct () { $this->transformColumns = [ 'archivedAt' => (function ($column) { return 'archived_at'; }) ]; } public function set (string $column, $value) { if (isset($this->transformColumns[$column])) { $column = $this->transformColumns[$column]($column); } if (isset($this->transformValues[$column])) { $value = $this->transformValues[$column]($value); } $this->properites[$column] = $value; return; } public function __set ($column, $value) { return $this->set($column, $value); } public function get(string $column) { if (isset($this->transformColumns[$column])) { $column = $this->transformColumns[$column]($column); } return $this->properites[$column]; } public function __get ($column) { return $this->get($column); } } $o = new Entity(); $o->archived_at = (new DateTime())->format('d-m-Y H:i:s'); echo '<pre>', var_dump($o), '</pre>';
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Cannot instantiate abstract class App\Entity\Entity in /in/FXohP:47 Stack trace: #0 {main} thrown in /in/FXohP on line 47
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Cannot instantiate abstract class App\Entity\Entity in /in/FXohP on line 47
Process exited with code 255.

preferences:
264.08 ms | 402 KiB | 324 Q