3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public string $abc = "foo"; } $obj = unserialize('O:1:"A":1:{s:3:"abc";i:42;}'); var_dump($obj); var_dump($obj->abc);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: Cannot assign int to property A::$abc of type string in /in/edjPq:7 Stack trace: #0 /in/edjPq(7): unserialize('O:1:"A":1:{s:3:...') #1 {main} thrown in /in/edjPq on line 7
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Typed property A::$abc must be string, int used in /in/edjPq:7 Stack trace: #0 /in/edjPq(7): unserialize('O:1:"A":1:{s:3:...') #1 {main} thrown in /in/edjPq on line 7
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/edjPq on line 4
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33
Parse error: syntax error, unexpected 'string' (T_STRING), expecting variable (T_VARIABLE) in /in/edjPq on line 4
Process exited with code 255.

preferences:
94.61 ms | 2162 KiB | 4 Q