3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $urlKey = 'dfbhkjdsfhsdkfkj-565576-786.html'; $oldUrlKey = null; if (preg_match('/^.*-[0-9]+(-[0-9]+)\.html$/', $urlKey, $matches)) { $oldUrlKey = str_replace($matches[1], '', $urlKey); } echo $urlKey; echo '<br>' .$oldUrlKey;
Output for 4.3.0 - 7.1.0
dfbhkjdsfhsdkfkj-565576-786.html<br>dfbhkjdsfhsdkfkj-565576.html