7 ms·
You'd turn error reporting off completely for prod anyway. Please don't use @
by jtreminio 14y ago
You'd turn error reporting off completely for prod anyway.
Please don't use @
- klibertp 14y agoI won't, because I will never again use PHP :) Oh, I just thought that maybe php.ini is another thing that's specific to the web... But I'm not sure, for example there is site.py file in every Python distribution which effectively serves the same purpose, just uses Python instead of ini format. Anything else in the language? I'm really curious.
- fein 14y agoI use PHP every day, and kind of take pride in that. We get a lot of shit for this labor of love, but damn do I enjoy it. That being said, the PHP ini is a config file that defines some of PHP's runtime parameters and, in some cases, controls modules and drivers that have been installed for PHP. The closest thing I can think of comparing it to would be the JVM config. I use PHP for a crapton of scripting as well, namely scraping, which has nothing to do with PHP's web app capabilities as that all leverages curl.
- nir 14y agoThe part where PHP files are essentially HTML files (ie you can start with a file consisting of "<b>hello world</b>" and add some code as you go) is where the made-for-web really shows. While obviously a bad practice, it also enables non-devs to organically learn the language in bits and pieces. Sometimes they move on to create hugely influential platforms like MediaWiki and Wordpress, sometimes they just build very hard to maintain websites. PHP in a nutshell.
- nnq 14y agowhat about all the simple cases where one could replace the more verbose: if (empty($arr['key'])) with: if (@$arr['key']) ? People have started using this and I find no reason to tell them "it's bad practice", although it only spares 5 chars typing...
- Firehed 14y ago@ is extremely slow. @$arr['key'] is the same as $er = error_reporting(0); $arr['$key']; error_reporting($er); unset($er); Probably more importantly is that the internal errors are still being raised, there's just additional comparison logic within the PHP engine to suppress them internally.