3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CLocale { public function test() { return self::getCanonicalID('foo-bar'); } public static function getCanonicalID($id) { return strtolower(str_replace('-','_',$id)); } } class MyLocale extends CLocale { public static function getCanonicalID($id) { return strtolower(str_replace('-','/',$id)); } } echo (new MyLocale())->test();

preferences:
23.01 ms | 405 KiB | 5 Q