Re:PHP solves problems. Oh, and you can program with it too
by blindhippo on Saturday June 30, 2012 @07:52AM
(#4181402)
1) Isn't this a problem with all dynamic languages? And isn't this why the '===' operator exists?
2) Explain - seriously. To me this level of thing isn't the realm of PHP but rather the web server in front of it. If someone is doing something that requires multi-threaded programming, they clearly don't know what PHP is used for and they chose the wrong tool. Their choice doesn't invalidate PHP for it's intended use case.
Re:PHP solves problems. Oh, and you can program with it too
by oinksoft on Friday June 29, 2012 @08:00PM
(#4179806)
1) Certainly doesn't convince me. In the third test, no type coercion is performed.
2) I'm not sure what this statement has to do with anything.
Re:PHP solves problems. Oh, and you can program with it too
by ericingram on Friday June 29, 2012 @08:30PM
(#4179927)
I wonder if you've actually built a web app before? Your statements about PHP are so off base.
Re:PHP solves problems. Oh, and you can program with it too
by 10098 on Friday June 29, 2012 @08:34PM
(#4179935)
For example?
Re:PHP solves problems. Oh, and you can program with it too
by dr42 on Friday June 29, 2012 @07:56PM
(#4179789)
This may appear 'retarded' until you understand how type conversion works. Then those examples are perfectly logical and expected. PHP has === if you want to disable the type conversion in the conditional operator.
Re:PHP solves problems. Oh, and you can program with it too
by jules on Friday June 29, 2012 @10:09PM
(#4180182)
Knowing how something works does not make it a good idea. I see this attitude a lot: if you've mastered something complicated, it seems so logical and inevitable. I had this attitude myself once when I only knew PHP. But then you discover that PHP is not god given or a natural phenomenon. A human put each and every behavior in a programming language. Some choices are better than others. Significantly worse choices were made in PHP than in e.g. Python. Therefore new programmers should learn a language like Python, not PHP. It's a waste of time to learn the intricacies of things that ended up that way due to a bad decision or even by accident. Note that Python is far from perfect too, but it's one of the least bad to start with.
Re:PHP solves problems. Oh, and you can program with it too
by 10098 on Friday June 29, 2012 @08:02PM
(#4179814)
I know about ===. I do understand how type conversion works. I just don't think that it works "correctly". Converting "0" to 0 implicitly seems completely illogical to me. A string is not a number.
Re:PHP solves problems. Oh, and you can program with it too
by dr42 on Saturday June 30, 2012 @03:28AM
(#4181007)
"a string is not a number"
Well then use ===, but when a string contains numbers then php will do the type conversion for you. It's a convenience.
It may not work correctly by your definition but it's pretty intuitive and useful the way it is.
Does that convince you?
2) because processing some HTTP requests can be a tad bit more complicated than "do a select from a database and substitute the values into a template"