- str_replace: documentation ( source)
- strtolower: documentation ( source)
<?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();