3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Trigger { var $me='hello'; function __construct() { $b = Expected::kill(); echo "\n==LINE8_VARDUMP==\n"; var_dump($b); return $b; } } class Expected { var $killerMessage=null; function __construct() { $this->killerMessage = 'Oops!'; return $this; } static function kill() { return new Expected; } } $obj = new Trigger; echo "\n==LINE21_VARDUMP==\n"; var_dump($obj); //-------------------------------------- //Current Output: //==LINE8_VARDUMP== //object(Expected)#2 (1) { // ["killerMessage"]=> // string(5) "Oops!" //} // //==LINE21_VARDUMP== //object(Trigger)#1 (1) { // ["me"]=> // string(5) "hello" //} // //Expected Output: //Both VARDUMP //object(Expected)#2 (1) { // ["killerMessage"]=> // string(5) "Oops!" //} ?>

preferences:
31.71 ms | 402 KiB | 5 Q