3 ms·
I'm going to try to preempt any "PHP sucks" comments with my Quora response: http://www.quora.com/What-are-PHP-s-main-flaws-(and-good-parts)/answer/Brian-Kraus
by bkrausz 16y ago
I'm going to try to preempt any "PHP sucks" comments with my Quora response:
http://www.quora.com/What-are-PHP-s-main-flaws-(and-good-parts)/answer/Brian-Krausz http://www.quora.com/What-are-PHP-s-main-flaws-(and-good-par...
- IgorPartola 16y agoIMHO, PHP's main flaws are not in the types of features discussed by OP. It's mostly an issue of naming and namespacing. Another thing that is kind of wrong about it is the URL => file semantics (when used as a web framework). Other frameworks do this better which results in clean URL's and more structured codebases. Amongst other things that PHP gets right is the date/time handling (two functions to go between datetimes and UNIX timestamps, support for timezones).
- invisible 16y agoPHP is a language (just like Ruby and Python are to Rails and Django). Here are some PHP frameworks (that handle URL => resource instead of URL => file): http://www.phpframeworks.com/ http://www.phpframeworks.com/
- IgorPartola 16y agoYes I am aware, but I see PHP as somewhere in between a general purpose scripting language and a web framework. It does have features that are very specific to web development: parsing of query strings and post data and cookies, built-in headers function, templating. That last one is funny since that's where the language came from: a DSL for putting some dynamic content into HTML. Nowadays people consider it clunky so things like Smarty were built in PHP to handle templating better.
- narrator 16y agoAny of you guys use CakePHP? I've inherited a project that uses it. It seems ok, a bit like Rails...
- treeface 16y agoIf these are your main complaints with PHP, you need to look into CodeIgniter.
- lmz 16y agoCodeIgniter as a request dispatcher is OK, but as a framework it's not very clean. Single instance of every library + methods that mutate the global instance (see the bundled mail library)? No way to trap database errors (unique constraint violation,etc.) and if debug is enabled it simply die()s?
- bobds 16y agoYou only have to look at CodeIgniter if you plan to be stuck with PHP 4.
- Fluxx 16y agoNaming, oh god yes, the naming. Nothing is consistent with naming functions at all. My favorite example of this is the aptly named "parse_str" function: http://us2.php.net/manual/en/function.parse-str.php http://us2.php.net/manual/en/function.parse-str.php
- IgorPartola 16y agoAh that one is my favorite. The second parameter is optional, but if you don't pass it in it's a noop. Don't really get where that came from.
- andfarm 16y agoOhohoho. No... if you omit the second parameter, PHP sets variables from the query string in your local scope. Surprise! It's register_globals all over again.
- IgorPartola 16y agoWow. That's so fantastic I can't even describe it. I can't imagine how much buggy software there is out there because of this.