3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urlKey = 'ftrcvgbhnjk-2000-4628-20.html'; /** * Needed for backward compatibility reasons, ensure correct resolving of old product urls * Removes the category part of the url villa-3565-67.html => villa-3565.html and indexed the old url */ $oldUrlKey = null; if (preg_match('/^.*-[0-9]+(-[0-9]+)\.html$/', $urlKey, $matches)) { $oldUrlKey = substr_replace($urlKey, '', strrpos($urlKey, $matches[1]), strlen($matches[1])); $index[$oldUrlKey] = $data; } var_dump(oldUrlKey, $matches);

preferences:
36.56 ms | 402 KiB | 5 Q