note 42211 added to class.dir

From: Date: Fri, 07 May 2004 22:02:53 +0000
Subject: note 42211 added to class.dir
Groups: php.notes 
Request: Send a blank email to php-notes+get-69331@lists.php.net to get a copy of this message
The Problem to make a script crawling through Windows and Unix directories is that Windows unses '\' or '\\' and Unix uses '/' as diretory seperator. To make a script running an both platforms you can use the PHP internal constant PHP_OS : if ( strpos( PHP_OS, 'WIN' ) !== FALSE ) { $dir_seperator ='\\'; } elseif ( strpos( PHP_OS, 'Linux' ) !== FALSE ) { $dir_seperator ='/'; } And now you can use the variable $dir_seperator for your [ rekursive ] crawling through directories. ---- Manual Page -- http://www.php.net/manual/en/class.dir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42211 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42211&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42211&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69331) next »