note 86507 modified in function.dirname by danbrown

From: Date: Wed, 22 Oct 2008 16:18:34 +0000
Subject: note 86507 modified in function.dirname by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145601@lists.php.net to get a copy of this message
dirname can be used to fix paths: <?php function fixPath ($path) ( return dirname($path . '/.'); ) fixPath('/one'); // '/one' fixPath('/one/'); // '/one' fixPath('/one//two'); // '/one/two' fixPath('/one////two////'); // '/one/two' ?> --was-- dirname can be used to fix paths: function fixPath ($path) ( return dirname($path . '/.'); ) fixPath('/one') // '/one' fixPath('/one/') // '/one' fixPath('/one//two') // '/one/two' fixPath('/one////two////') // '/one/two' http://php.net/manual/en/function.dirname.php

« previous php.notes (#145601) next »