You are here: Re: Dose PHP support recursive call? Walk through all subdir « PHP Programming Language « IT news, forums, messages
Re: Dose PHP support recursive call? Walk through all subdir

Posted by Daniel Tryba on 06/08/05 17:22

RC <raymond.chui@nospam.noaa.gov> wrote:
> OK, I re-write the function, it is work, now.

So I guess you found out that you weren't setting the correct path?

Your new function might get you into trouble in case chdir() fails. You
could check if the directory you are about to readSubdir() to is
executable and readable... else there is no point to even go there.

Better yet it so fix your original code and append the found dir to the
$dirPath in the new readSubdir() call...

> while (($file = readdir($dirPointer)) != false) {

Also this will get you into trouble for files called "0". Never ever use
!= if you know that an error results in a boolean false, always use
!==/=== when types are known.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация