/** * A non mbstring overloadable strlen-like function. * * @param string $string The string whose length we want to get. * @return integer The length of the string. */ private function strlen2($string) { return array_sum(char_count($string)); }
function content_get_up_to_root($path) { $root_dir = config_get('site-root') . config_get('document-root'); $delta = char_count('/', $path) - char_count('/', $root_dir); $r = ''; for ($i = 0; $i < $delta; $i++) { $r .= '../'; } return $r; }