FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » string length
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: string length [message #185326 is a reply to message #185325] Tue, 18 March 2014 17:47 Go to previous messageGo to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
In article <lg9qie$i09$2(at)news(dot)albasani(dot)net>, The Natural Philosopher
<tnp(at)invalid(dot)invalid> wrote:

> Also keep in mind that '.' and '..' will appear in readdir() listings.
>
> From the readdir manual entry...
>
> <?php
> if ($handle = opendir('.')) {
> while (false !== ($entry = readdir($handle))) {
> if ($entry != "." && $entry != "..") {
> echo "$entry\n";
> }
> }
> closedir($handle);
> }
> ?>

$dirh = opendir ($start);
if ($dirh===false)
{
// handle error and return or exit
}

while (true)
{

$nextfile = readdir ($dirh);
if ($nextfile===false) break;

if ($nextfile=='.' || $nextfile=='..') continue;

// Treat nextfile

}


Much easier. Notice how the braces don't get more than one deep
(instead of three).

--
"People don't buy Microsoft for quality, they buy it for compatibility
with what Bob in accounting bought last year. Trace it back - they buy
Microsoft because the IBM Selectric didn't suck much" - P Seebach, afc
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Nested PHP
Next Topic: weird global issue
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 20:37:10 GMT 2024

Total time taken to generate the page: 0.04631 seconds