3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $urlKey = 'ftrcvgbhnjk-2000-4628-20.html'; $oldUrlKey = null; if (preg_match('/^.*-[0-9]+(-[0-9]+)\.html$/', $urlKey, $matches)) { substr_replace($urlKey, '', strpos($urlKey, $matches[1]), strlen($matches[1])); $index[$oldUrlKey] = '----'; } var_dump($matches); echo $oldUrlKey;
Output for 4.3.0 - 7.1.0
array(2) { [0]=> string(29) "ftrcvgbhnjk-2000-4628-20.html" [1]=> string(3) "-20" }