3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array ( 0 => 'timestamp', 1 => '1447931724.712686', 2 => 'bridgeid', 3 => 'bc343ddc-78bf-4e5c-8ba5-cb0a9893a81a' ); function redishash_toarray ($in) { $arr = ''; $c = count($in)/2; for ( $k = 0 ; $k < $c; $k++) { $arr[$in[$k * 2 ]]=$in[$k * 2 + 1]; } } print_r(redishash_toarray ($arr));
Output for 8.0.7 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/HafQP:16 Stack trace: #0 /in/HafQP(21): redishash_toarray(Array) #1 {main} thrown in /in/HafQP on line 16
Process exited with code 255.
Output for 8.0.0 - 8.0.6
Warning: Only the first byte will be assigned to the string offset in /in/HafQP on line 16 Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/HafQP:16 Stack trace: #0 /in/HafQP(21): redishash_toarray(Array) #1 {main} thrown in /in/HafQP on line 16
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: Illegal string offset 'timestamp' in /in/HafQP on line 16 Warning: Illegal string offset 'bridgeid' in /in/HafQP on line 16
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20

preferences:
164.71 ms | 402 KiB | 183 Q