Hacker News new | past | comments | ask | show | jobs | submit login
Why PHP is (still) the easiest web programming language to learn (stackoverflow.com)
15 points by dorkitude on Jan 15, 2011 | hide | past | favorite | 9 comments



It's a bad comparison. PHP is not an alternative to Rails or Django. It's more like an alternative to Perl. PHP is a language, Rails/Django are frameworks and thus necessarily far-more complex.


I disagree. PHP is a web framework. It comes with built-in functionality for talking to databases, extracting form variables, setting cookies, outputting HTML, routing URLs - everything you'd need expect to need a web framework for with other languages.


I think the particular thing about PHP that makes it framework-like is that it handles HTTP almost 100% transparently for the PHP coder. In any other language I've seen, the coder is responsible for handling and outputting HTTP headers, parsing the query, etc... PHP just does that stuff.


If we follow your logic, C is a framework for building OSes.


You're going to need to explain further how C is endowed with all the capabilities normally associated with OS-building frameworks (which I've never heard of).


PHP is most definitely an alternative to Rails or Django. Just as going raw WSGI in Python is.

> PHP is a language, Rails/Django are frameworks and thus necessarily far-more complex.

Which completely misses the point of the linked comment, which is that PHP deployment is utterly trivial and that the mapping between URLs and PHP code is extremely simple to understand, creating a very low cognitive load on the user.

Replace "Rails/Django" by "Ruby/Rack or Python/WSGI" and you have the same level of abstraction as PHP (well probably lower actually as you don't get stuff like $GET/$POST/$GET), yet you still don't get trivial deployments and easy-to-understand mapping between code files and URLs.


Except that printing back the value of a POST parameter in PHP is just.

    <?php
        echo htmlspecialchars($_POST["name"]);
    ?>
Most other languages would need a lot more (even with things like mod_perl). Plain PHP is definitely incomparable to Rails/Django but for web development, it definitely is much more than just Perl/Python/Ruby.


Also, finding a web host that supports Python or Ruby may be easy, but finding a web host that doesn't support PHP is damn near impossible.


That example holds true until you start using a framework :-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: