3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class TestCommand { public function __construct( private string $name, public bool $isDeveloper, public int $age, public int $id, ) {} } /* $testCommand = new TestCommand('John', 25, true); var_dump($testCommand); echo serialize($testCommand); */ $serializedClass = 'O:11:"TestCommand":3:{s:4:"name";s:4:"John";s:3:"age";i:25;s:11:"isDeveloper";b:1;}'; $testCommand = unserialize($serializedClass); var_dump($testCommand);
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.17, 8.5.0 - 8.5.2
object(TestCommand)#1 (3) { ["name":"TestCommand":private]=> string(4) "John" ["isDeveloper"]=> bool(true) ["age"]=> int(25) ["id"]=> uninitialized(int) }

preferences:
48.41 ms | 406 KiB | 5 Q