note 36669 deleted from function.include by sniper

From: Date: Tue, 04 Nov 2003 00:43:12 +0000
Subject: note 36669 deleted from function.include by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59801@lists.php.net to get a copy of this message
Note Submitter: srjosh@!nospam!.maestrakara.com ---- CORRECTION: function new_address($dest){ //splits current directory into an array to be compared to target directory. $current = explode ("/", $_SERVER["SCRIPT_NAME"]); //splits target directory into an array to be compared to current directory. $dest = explode ("/", $dest); for ($x=0;$x<count($dest);$x++){ if ($dest[$x]==$current[$x] && count($current) > 2){ $toURL = $toURL . "../"; } elseif ($dest[$x]!=$current[$x] && $x == count($dest)-1) { $toURL = $toURL . $dest[$x]; } elseif ($dest[$x]!=$current[$x]) { $toURL = $toURL . $dest[$x] . "/"; } } return ($toURL); } Original code only worked in subdirectories. This works everywhere. My first addition to the PHP dox, followed immediately by my first correction. typical.

« previous php.notes (#59801) next »