note 60725 deleted from function.strstr by thiago

From: Date: Tue, 28 Oct 2008 13:43:23 +0000
Subject: note 60725 deleted from function.strstr by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145866@lists.php.net to get a copy of this message
Note Submitter: always_sleepz0r at removethisyahoo dot co dot uk ---- //this is my little version function rdir($d_d, $filter = null) { $d = dir($d_d);while(false !== ($entry = $d->read())) { if ($entry!=".." && $entry!="." && $filter==null || true==stristr($entry, $filter)){ if (!is_dir($entry)) { $ret_arr['f'][]=$entry;}else{$ret_arr['d'][]=$entry; }}}$d->close();return $ret_arr;} //usage: $d="folder"; $dd=rdir($d); //will return array with all files and folder names $dd=rdir($d, "requiredneedle"); //will return array with only file/folder names containing "requiredneedle". //$dd['f'] = files and $dd['d'] = folders echo "<pre>";print_r($dd);echo "</pre>";

« previous php.notes (#145866) next »