3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); } ?>
based on eePGH
Output for 7.3.0alpha1 - 7.3.0beta1
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 5.6.0 - 5.6.30, 7.0.0 - 7.2.8
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
Output for hhvm-3.18.4 - 3.21.0
Array ( [0] => Containerdienst [1] => {{stadt}} [2] => - [3] => Container [4] => günstig [5] => mieten ) Warning: in_array() expects parameter 2 to be an array or collection in /in/eEDAg on line 6