5 ms·
I mostly agree with the article, but my opinion of PHP is that it is a language that allows you to write bad code, but you can write good code in it. With regar
by Pengwin 14y ago
I mostly agree with the article, but my opinion of PHP is that it is a language that allows you to write bad code, but you can write good code in it. With regards to the example:
$ php -a
Interactive shell
php > echo "I'm your father" + Luke + 2 + $nothingtosee;
PHP Notice: Use of undefined constant Luke - assumed 'Luke' in php shell code on line 1
PHP Notice: Undefined variable: nothingtosee in php shell code on line 1
2
So the output is true, but you are given error notices. Back when I started PHP I thought nothing of notices (I also had no way of seeing them as it was all uploaded to a shared hosting environment and error_reporting was set to hide them). After years of programming websites and maintain code of people who were in my position before me i started to realize what got you in to trouble later on. I ensure that numbers are numbers, and not strings, and assume that all unknown type variables are strings.
PHP as a language also does not expose you to anything low level, but that is what scripting languages should do. They are not for the Applications that work all day, they should execute, give you the result, and be gone.