3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $url = 'htttp://www.foobar.de/slideshow?parms=11,22&something=else'; $newSlideNo = 44; $searchPattern = '/(.*\d+,\d+,)(\d*)(.*)/'; $replacePattern = sprintf('${1}' . $newSlideNo . '${3}'); var_dump(preg_replace($searchPattern, $replacePattern, $url));
based on UamoH
Output for 5.3.21 - 7.3.0rc4
string(58) "htttp://www.foobar.de/slideshow?parms=11,22&something=else"