Re: AW: AW: PHP is Zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il Thu, 13 Jun 2013 13:27:51 +0200, BUSCHKE Daniel ha scritto:

> Why is PHP doing that?

Because a decision had to be made, and they chose to do it that way.

> I know it works as designed and I know it is
> documented like this but that does not mean that it is a good feature,
> does it?

It is a political decision. In a weakly typed language (by design) you 
have to decide how to convert types. it is documented:

http://www.php.net/manual/en/language.types.type-juggling.php

http://www.php.net/manual/en/
language.types.string.php#language.types.string.conversion

If you need stricter conversions, you can cast whatever you want to 
whatever else, and use ===

> So lets talk about the question: Is that behaviour awaited by
> PHP software developers?

Yes. At least for me.

> Is that really the way PHP should work here?

Yes. By design.

> May we should change that?!

No. It would break backwards compatibility. A lot. And it would make PHP 
a strongly typed language.

> BTW: I talked to some collegues and friends since my first post. They
> all guessed that "'PHP' == 0" is false within a few seconds. I think the
> weak-typed-PHP is a little to weak at this point.

Maybe because they are used to other languages.

Javascript has similar rules, but Python has different ones, as it is NOT 
weakly typed, just dinamically typed.

You just have to enter a different mindset. PHP is not Java or Python. It 
is PHP. You should use the way it was designed, not by any other 
languages rules.

One of the reasons I prefer PHP over Python is because it is weakly typed 
(another is the spaces-tab-madness)

Bye.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux