3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public string $abc = "foo"; } var_dump(unserialize('O:1:"A":1:{s:3:"abc";i:42;}'));
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/1BsVj:7 Stack trace: #0 /in/1BsVj(7): unserialize('O:1:"A":1:{s:3:...') #1 {main} thrown in /in/1BsVj on line 7
Process exited with code 255.
Output for 7.4.3 - 7.4.33
Fatal error: Uncaught TypeError: Typed property A::$abc must be string, int used in /in/1BsVj:7 Stack trace: #0 /in/1BsVj(7): unserialize('O:1:"A":1:{s:3:...') #1 {main} thrown in /in/1BsVj on line 7
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.33
Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/1BsVj on line 4
Process exited with code 255.
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.21, 7.0.0 - 7.0.6
Parse error: syntax error, unexpected 'string' (T_STRING), expecting variable (T_VARIABLE) in /in/1BsVj on line 4
Process exited with code 255.

preferences:
44.71 ms | 1624 KiB | 4 Q