OOP in PHP 4 and 8 ################## :category: PHP :date: 2020-10-02 15:03:00 +0300 :tags: php 4, php 8 Deprecation of class name constructors means that you no longer can write OOP code that works both in PHP 4 and PHP 8 without some hackery. `This works however`__: .. __: https://3v4l.org/ZBTcC .. code-block:: php int = $int; } // Constructor in PHP 4 // Constructor overridden by __construct in 5-7 // Regular method in PHP 8 function WorksIn4And8($int) { error_log('WorksIn4And8()'); $this->__construct($int); } function getInt() { return $this->int; } } $obj = new WorksIn4And8(48); var_dump($obj->getInt());