From 2844584ff3fc18be6cdd83e4cb80f35197a962d1 Mon Sep 17 00:00:00 2001 From: Ben Coburn <btcoburn@silicodon.net> Date: Wed, 5 Jul 2006 13:46:01 +0200 Subject: [PATCH] optimize noNS darcs-hash:20060705114601-05dcb-e8fda6653d8d085591d578f24d3677b29f09fa01.gz --- inc/pageutils.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inc/pageutils.php b/inc/pageutils.php index c10c1c4e8..4859465bb 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -123,8 +123,13 @@ function getNS($id){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function noNS($id){ - return preg_replace('/.*:/','',$id); +function noNS($id) { + $pos = strrpos($id, ':'); + if ($pos!==false) { + return substr($id, $pos+1); + } else { + return $id; + } } /** -- GitLab