3v4l.org

run code in 300+ PHP versions simultaneously
<?php class parent1 { public function __construct($param) { var_dump($param); } } class child extends parent1 { public function method() { //而且我在这里直接return居然不生效,代码直接从 //parent::__construct($param);开始执行,也就是说前面的代码没有执行,问题应该就在这里,不理解为什么不执行。 $param = 123; parent::__construct($param); } } (new child(1))->method();
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
int(1) int(123)

preferences:
96.88 ms | 402 KiB | 90 Q