note 20512 deleted from function.pathinfo by irc-html

From: Date: Mon, 22 Apr 2002 19:27:08 +0000
Subject: note 20512 deleted from function.pathinfo by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29691@lists.php.net to get a copy of this message
well see, not to say that anyone here is wrong, but i couldn't get any of the examples to work correctly when the function was used in the document root. using pathinfo() $pathinfo[dirname] would return $deep as 1 whether it was used in / or /somedir/. so, i rewrote the first one into this: function doc_root($path) { $deep = substr_count($path, "/"); for($i = 1; $i < $deep; $i++) { $document_root .= "../"; } return $document_root; } $document_root=doc_root($REQUEST_URI); now the function works because pathinfo() isn't used. Shawn Lawyer

« previous php.notes (#29691) next »