3v4l.org

run code in 300+ PHP versions simultaneously
<?php $main_teaser = "Containerdienst {{stadt}} - Container günstig mieten"; $arr_main_teaser = print_r(str_word_count($main_teaser, 1, '{}äüß')); if(in_array("{{stadt}}", $arr_main_teaser)) { $key = array_search('{{stadt}}', $arr_main_teaser); $replace = array($key => ucfirst($input->urlSegment1)); $new_main_teaser = array_replace($arr_main_teaser, $replace); print_r($new_main_teaser); } ?>
Output for 8.3.0 - 8.3.4, 8.3.6
Array ( [0] => Containerdienst [1] => {{stadt}} [2] => - [3] => Container [4] => günstig [5] => mieten ) Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, true given in /in/eEDAg:6 Stack trace: #0 /in/eEDAg(6): in_array('{{stadt}}', true) #1 {main} thrown in /in/eEDAg on line 6
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 Array ( [0] => Containerdienst [1] => {{stadt}} [2] => - [3] => Container [4] => günstig [5] => mieten ) Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, true given in /in/eEDAg:6 Stack trace: #0 /in/eEDAg(6): in_array('{{stadt}}', true) #1 {main} thrown in /in/eEDAg on line 6
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Array ( [0] => Containerdienst [1] => {{stadt}} [2] => - [3] => Container [4] => günstig [5] => mieten ) Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /in/eEDAg:6 Stack trace: #0 /in/eEDAg(6): in_array('{{stadt}}', true) #1 {main} thrown in /in/eEDAg on line 6
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Array ( [0] => Containerdienst [1] => {{stadt}} [2] => - [3] => Container [4] => günstig [5] => mieten ) Warning: in_array() expects parameter 2 to be array, bool given in /in/eEDAg on line 6
Output for 7.0.0 - 7.0.23, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33
Array ( [0] => Containerdienst [1] => {{stadt}} [2] => - [3] => Container [4] => günstig [5] => mieten ) Warning: in_array() expects parameter 2 to be array, boolean given in /in/eEDAg on line 6

preferences:
148.17 ms | 402 KiB | 177 Q