3v4l.org

run code in 300+ PHP versions simultaneously
<?php $haystack3 = '<span class=\'descr\'>test, test2, test3</span> <span class=\'descr\'>test</span> <span class=\'descr\'>test4 test5</span>'; preg_match_all('#^<span class=\'descr\'>(.*?)</span>$#m', $haystack3, $matches3); $data3 = explode(',', $matches3[1]); $data3 = array_filter(array_unique(array_map('trim', $data3))); natsort($data3); echo '<b>' . join(', ' , $data3 ) . '</b>'; echo "<br>\n"; echo '<font color="blue">' . '<b>' . count( $data3 ) . '</b>' . '</font>' . " tags were found." . '<br>'; ?>
Output for 8.1.23 - 8.1.30, 8.2.10 - 8.2.25, 8.3.0 - 8.3.4, 8.3.6 - 8.3.13
Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, array given in /in/A91Yj:7 Stack trace: #0 /in/A91Yj(7): explode(',', Array) #1 {main} thrown in /in/A91Yj on line 7
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, array given in /in/A91Yj:7 Stack trace: #0 /in/A91Yj(7): explode(',', Array) #1 {main} thrown in /in/A91Yj on line 7
Process exited with code 255.
Output for 5.6.0
Warning: explode() expects parameter 2 to be string, array given in /in/A91Yj on line 7 Warning: array_map(): Argument #2 should be an array in /in/A91Yj on line 8 Warning: array_unique() expects parameter 1 to be array, null given in /in/A91Yj on line 8 Warning: array_filter() expects parameter 1 to be array, null given in /in/A91Yj on line 8 Warning: natsort() expects parameter 1 to be array, null given in /in/A91Yj on line 9 Warning: join(): Invalid arguments passed in /in/A91Yj on line 10 <b></b><br> <font color="blue"><b>0</b></font> tags were found.<br>

preferences:
38.2 ms | 410 KiB | 5 Q