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); } ?>

preferences:
56.67 ms | 402 KiB | 5 Q