It's not my only argument. Here's what I wrote on the blog's own comments:
> I agree with your points, but picking this line as an example of the language’s problems
> is a bit of a straw man:
>
> “while ( ($filename = readdir($dh)) == true) $files[] = $filename;”
> Code like this smells terribly.
> First of all it uses “==”. That operator should trigger a deprecated warning, since it’s
> never appropriate. Even if you want the coercion, it’s better to write it explicitly with
> things like (int) or intval().
> Next, it’s using “== true”, which is completely redundant since the “while” will interpret
> the value as a boolean anyway.
> Next, it’s performing assignment inside a condition, which is generally frowned upon.
> There’s potential to confuse “=” with “==” or “===”, it’s using a statement in the place of
> an expression and it performs side-effects (setting the $filename value).
> After all that, it’s just duplicating existing functionality anyway: you could just say
> $files = scandir($dh).
It's not my only argument. Here's what I wrote on the blog's own comments:
> I agree with your points, but picking this line as an example of the language’s problems
> is a bit of a straw man:
>
> “while ( ($filename = readdir($dh)) == true) $files[] = $filename;”
>
> Code like this smells terribly.
>
> First of all it uses “==”. That operator should trigger a deprecated warning, since it’s
> never appropriate. Even if you want the coercion, it’s better to write it explicitly with
> things like (int) or intval().
>
> Next, it’s using “== true”, which is completely redundant since the “while” will interpret
> the value as a boolean anyway.
>
> Next, it’s performing assignment inside a condition, which is generally frowned upon.
> There’s potential to confuse “=” with “==” or “===”, it’s using a statement in the place of
> an expression and it performs side-effects (setting the $filename value).
>
> After all that, it’s just duplicating existing functionality anyway: you could just say
> $files = scandir($dh).