3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "foo"; $str = array_flip($str); echo $str[$i];;
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: array_flip(): Argument #1 ($array) must be of type array, string given in /in/MKZf9:1 Stack trace: #0 /in/MKZf9(1): array_flip('foo') #1 {main} thrown in /in/MKZf9 on line 1
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: array_flip() expects parameter 1 to be array, string given in /in/MKZf9 on line 1 Notice: Undefined variable: i in /in/MKZf9 on line 1 Notice: Trying to access array offset on value of type null in /in/MKZf9 on line 1
Output for 7.3.32 - 7.3.33
Warning: array_flip() expects parameter 1 to be array, string given in /in/MKZf9 on line 1
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.31
Warning: array_flip() expects parameter 1 to be array, string given in /in/MKZf9 on line 1 Notice: Undefined variable: i in /in/MKZf9 on line 1

preferences:
55.69 ms | 1482 KiB | 4 Q