3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<EOT etc etc etc content [crowdpdf-total=field_585b0b3288d2e] etc etc [crowdpdf-total=field_585b0b3288d2f] etc content EOT; $replacements = [ 'field_585b0b3288d2e'=> 864, 'field_585b0b3288d2f' => 987, ]; foreach ($replacements as $find => $replace) { $string = str_replace("[crowdpdf-total=$find]", $replace, $string); } echo $string;
Output for 5.6.0 - 5.6.29, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
etc etc etc content 864 etc etc 987 etc content

preferences:
165.22 ms | 404 KiB | 240 Q