3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
Output for 5.5.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: data in /in/4J062 on line 12 Notice: Use of undefined constant oldUrlKey - assumed 'oldUrlKey' in /in/4J062 on line 15 string(9) "oldUrlKey" array(2) { [0]=> string(29) "ftrcvgbhnjk-2000-4628-20.html" [1]=> string(3) "-20" }
Output for 4.3.0 - 5.4.45
string(9) "oldUrlKey" array(2) { [0]=> string(29) "ftrcvgbhnjk-2000-4628-20.html" [1]=> string(3) "-20" }