Is PHP flaky? Is it due to PHP's weak typing?

Continuing along from PHP: a fractal of not so bad design.

Eevee makes this remark:

PHP is flaky: ==, foreach ($foo as &$bar)

As this seems to be a theme throughout the whole article, Eevee seems to really dislike PHP’s weak typing. But, is it really grounds to call PHP flaky?

Or are there other reasons to call PHP flaky? Is PHP flaky to you at all?

Scott

I did not invent this expression but it fits great:
PHP gives you rope. It’s your job to use it :slight_smile:

4 Likes

Weak typing makes for a lower entry point into programming. It makes it easier for people to start coding who wouldn’t be able to get anything to work if they had to learn about data types first.

Of course PHP doesn’t force you to use weak typing - you can actually make sure yourself that you maintain the original type for each defined variable.

Also PHP is gradually adding options to help with this so that it is becoming easier to enforce typing in PHP if you want to.

3 Likes

tbh, I don’t even have an idea what he meant by foreach being flaky.

Normally when you foreach over an array then each element is read only. If you actually want to modify the element then you need the ambersand.

I guess our self-appointed expert deems this to be flaky.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.