3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = (object) array();$b = (object) array();function object_handle($obj){ static $mask = 0; if (!$mask) { $obj = (object) array(); $mask = hexdec(substr(spl_object_hash($obj), 0, 16)); foreach (debug_backtrace(PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) { if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], array('ob_clean','ob_end_clean','ob_flush','ob_end_flush','ob_get_contents','ob_get_flush'), true)) { $frame = false; break; } } if ($frame) { ob_start(); debug_zval_dump($obj); $mask ^= substr(ob_get_clean(), 17); } } return hexdec(substr(spl_object_hash($obj), 0, 16)) ^ $mask;}ob_start('abc');ob_end_flush();$o = [];echo object_handle($o[]=(object) array()), "\n";echo object_handle($o[]=(object) array()), "\n";echo object_handle($o[]=(object) array()), "\n";echo object_handle($o[]=(object) array()), "\n";echo object_handle($o[]=(object) array()), "\n";echo object_handle($o[]=(object) array()), "\n";echo object_handle($o[]=(object) array()), "\n";echo object_handle($b), "\n";echo object_handle($a), "\n";function abc(){ global $a; return object_handle($a);}ob_start('abc');
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
00 7 6 5 4 11 10 1 2 2
Output for 5.6.28
00 7 6 5 4 11 10 1 2 621392074
Output for 5.6.21
00 7 6 5 4 11 10 1 2 1773989950
Output for 5.6.20
00 7 6 5 4 11 10 1 2 1260512152
Output for 5.6.19
00 7 6 5 4 11 10 1 2 1548252673
Output for 5.6.18
00 7 6 5 4 11 10 1 2 887208974
Output for 5.6.17
00 7 6 5 4 11 10 1 2 2092620028
Output for 5.6.16
00 7 6 5 4 11 10 1 2 1062271268
Output for 5.6.15
00 7 6 5 4 11 10 1 2 984626608
Output for 5.6.14
00 7 6 5 4 11 10 1 2 1710514335
Output for 5.6.13
00 7 6 5 4 11 10 1 2 1153506714
Output for 5.6.12
00 7 6 5 4 11 10 1 2 108051213
Output for 5.6.11
00 7 6 5 4 11 10 1 2 1316640161
Output for 5.6.10
00 7 6 5 4 11 10 1 2 1856923143
Output for 5.6.9
00 7 6 5 4 11 10 1 2 1724201321
Output for 5.6.8
00 7 6 5 4 11 10 1 2 183524736
Output for 5.5.35
00 7 6 5 4 11 10 1 2 1483499853
Output for 5.5.34
00 7 6 5 4 11 10 1 2 1994410857
Output for 5.5.33
00 7 6 5 4 11 10 1 2 824766836
Output for 5.5.32
00 7 6 5 4 11 10 1 2 1070397237
Output for 5.5.31
00 7 6 5 4 11 10 1 2 521489111
Output for 5.5.30
00 7 6 5 4 11 10 1 2 731031595
Output for 5.5.29
00 7 6 5 4 11 10 1 2 1454540062
Output for 5.5.28
00 7 6 5 4 11 10 1 2 857623378
Output for 5.5.27
00 7 6 5 4 11 10 1 2 1350851530
Output for 5.5.26
00 7 6 5 4 11 10 1 2 818074704
Output for 5.5.25
00 7 6 5 4 11 10 1 2 256303857
Output for 5.5.24
00 7 6 5 4 11 10 1 2 1465939545
Output for 5.4.45
00 7 6 5 4 11 10 1 2 1213447030
Output for 5.4.44
00 7 6 5 4 11 10 1 2 1505036327
Output for 5.4.43
00 7 6 5 4 11 10 1 2 1742909217
Output for 5.4.42
00 7 6 5 4 11 10 1 2 285874654
Output for 5.4.41
00 7 6 5 4 11 10 1 2 2091481392
Output for 5.4.40
00 7 6 5 4 11 10 1 2 34827954
Output for 5.4.39
00 7 6 5 4 11 10 1 2 961450238
Output for 5.4.38
00 7 6 5 4 11 10 1 2 790912120
Output for 5.4.37
00 7 6 5 4 11 10 1 2 1134800263
Output for 5.4.36
00 7 6 5 4 11 10 1 2 1425144222
Output for 5.4.35
00 7 6 5 4 11 10 1 2 489535673
Output for 5.4.34
00 7 6 5 4 11 10 1 2 1343967296
Output for 5.4.32
00 7 6 5 4 11 10 1 2 1940537224
Output for 5.4.31
00 7 6 5 4 11 10 1 2 988756694
Output for 5.4.30
00 7 6 5 4 11 10 1 2 1320192378
Output for 5.4.29
00 7 6 5 4 11 10 1 2 1935819481
Output for 5.4.28
00 7 6 5 4 11 10 1 2 22635931
Output for 5.4.27
00 7 6 5 4 11 10 1 2 214458644
Output for 5.4.26
00 7 6 5 4 11 10 1 2 67709354
Output for 5.4.25
00 7 6 5 4 11 10 1 2 198628642
Output for 5.4.24
00 7 6 5 4 11 10 1 2 1703583406
Output for 5.4.23
00 7 6 5 4 11 10 1 2 1094655236
Output for 5.4.22
00 7 6 5 4 11 10 1 2 1673192062
Output for 5.4.21
00 7 6 5 4 11 10 1 2 1922831269
Output for 5.4.20
00 7 6 5 4 11 10 1 2 1015358920
Output for 5.4.19
00 7 6 5 4 11 10 1 2 1893390679
Output for 5.4.18
00 7 6 5 4 11 10 1 2 959559792
Output for 5.4.17
00 7 6 5 4 11 10 1 2 135518177
Output for 5.4.16
00 7 6 5 4 11 10 1 2 374517868
Output for 5.4.15
00 7 6 5 4 11 10 1 2 826004306
Output for 5.4.14
00 7 6 5 4 11 10 1 2 1641967660
Output for 5.4.13
00 7 6 5 4 11 10 1 2 29572959
Output for 5.4.12
00 7 6 5 4 11 10 1 2 1197604701
Output for 5.4.11
00 7 6 5 4 11 10 1 2 430387806
Output for 5.4.10
00 7 6 5 4 11 10 1 2 1611212977
Output for 5.4.9
00 7 6 5 4 11 10 1 2 2005143184
Output for 5.4.8
00 7 6 5 4 11 10 1 2 1887069216
Output for 5.4.7
00 7 6 5 4 11 10 1 2 768254745
Output for 5.4.6
00 7 6 5 4 11 10 1 2 745432623
Output for 5.4.5
00 7 6 5 4 11 10 1 2 425052581
Output for 5.4.4
00 7 6 5 4 11 10 1 2 1645188233
Output for 5.4.3
00 7 6 5 4 11 10 1 2 456578555
Output for 5.4.2
00 7 6 5 4 11 10 1 2 745233645
Output for 5.4.1
00 7 6 5 4 11 10 1 2 349427846
Output for 5.4.0
00 7 6 5 4 11 10 1 2 1417378144
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ZDhJc on line 1
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/ZDhJc on line 1
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZDhJc on line 1
Process exited with code 255.

preferences:
232.3 ms | 401 KiB | 307 Q