Ask HN: Why no love for PHP?
41–50 of 150 posts
Re: Ask HN: Why no love for PHP?
#42It reminds me of Perl. Perl literally gave me a headache last time I coded in it. (Incidentally, this is why I'm wary of Ruby as well.) Besides, I am totally satisfied with Python.
I don't see too much similarity between Perl and PHP. Perl has a the syntax of a loose cannon. PHP's syntax is very Java like. * PHP doesn't have special variables that change things about the language like, the starting index of an array. * Out of the box, Perl requires you to import modules to get functionality that PHP has with a simple function call. * Perl has support for classes, but you feel like it's a hack e…
Check out Moose for Perl. Then name an OO system in production that is better.
(-: If you can give an example, I'll immediately buy a book on it. :-)
Edit: Syntax.
Re: Ask HN: Why no love for PHP?
#43Earlier quoted context omitted.
Amusing. Rails as the "Dane Cook" of web frameworks pretty much hits the nail on the head. I love Rails but the fanboy culture really sucks.
That reads to me as "Rails is a pop culture icon that only XYZ people know about." I'm not XYZ because I don't know who that is. Actually, perhaps unintentionally, you still hit the nail on the head.
Re: Ask HN: Why no love for PHP?
#44The great thing about PHP is that the difficult problems have mostly been worked out. Getting a PHP site up and running and scalable is standard stuff.
Re: Ask HN: Why no love for PHP?
#45PHP has a few downsides, everything from poor naming conventions to security vulnerabilities. People around these parts are always looking for the cleanest solutions to their problems and the latest methods available. PHP's relative age and problems make it neither. That said, I coded my first startup in PHP. It's dead simple to make a dynamic web page with PHP, but it's also dead simple to create a huge mess. In tha…
I agree with more or less with what you said but a downside of PHP is not security vulnerabilities, that's really just a myth. I can't remember the last vulnerability which could be directly attributed to PHP as a language. Sure, there are plenty of apps containing holes but those are not caused by PHP but by not coding correctly, eg not checking input making SQL injections possible etc. Which might confirm what you…
----------
mysql_escape_string() - Escapes a string for use in a mysql_query
mysql_real_escape_string() - Escapes special characters in a string for use in a SQL statement
mysqli_real_escape_string() - Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection
addslashes() - Quote string with slashes
stripslashes() - Un-quotes a quoted string
The magic_quotes_gpc directive
The magic_quotes_runtime directive
stripcslashes() - Un-quote string quoted with addcslashes
stripslashes() - Un-quotes a quoted string
addcslashes() - Quote string with slashes in a C style
htmlspecialchars() - Convert special characters to HTML entities
quotemeta() - Quote meta characters
get_magic_quotes_gpc() - Gets the current configuration setting of magic quotes gpc
----------------
I especially love the contrast between "mysql_escape_string" and "mysql_real_escape_string," since the first one is fake in a magical, side-effect-laden way.
Re: Ask HN: Why no love for PHP?
#46Re: Ask HN: Why no love for PHP?
#47PHP has a few downsides, everything from poor naming conventions to security vulnerabilities. People around these parts are always looking for the cleanest solutions to their problems and the latest methods available. PHP's relative age and problems make it neither. That said, I coded my first startup in PHP. It's dead simple to make a dynamic web page with PHP, but it's also dead simple to create a huge mess. In tha…
I agree with more or less with what you said but a downside of PHP is not security vulnerabilities, that's really just a myth. I can't remember the last vulnerability which could be directly attributed to PHP as a language. Sure, there are plenty of apps containing holes but those are not caused by PHP but by not coding correctly, eg not checking input making SQL injections possible etc. Which might confirm what you…
http://osvdb.org/search?request=Python
http://osvdb.org/search?request=Perl
http://osvdb.org/search?request=Ruby
"One of these things, is not like the others, one of these things is not the same..."
No, there's nothing "mythical" about bad PHP security. At the point where there is a two order-of-magnitude difference between PHP and Python/Perl/Ruby, I stop even really caring about the "why". PHP may be popular, but it's not that much more popular. (And even if you want to say that PHP is two orders of magnitude more popular, well, not all Python/Perl/Ruby vulns are web-related, either.)
Re: Ask HN: Why no love for PHP?
#48While PHP by itself can be a challenge to work with, various frameworks and platforms abstract those idiosyncrasies while providing a significant increase in out of the box features and functionality.
For instance, NOLOH (http://www.noloh.com) is one such platform. Others such as Yii and CodeIgniter, while not as robust in certain respects, do a good job of this too.
(Full-disclosure: I'm a co-founder of NOLOH)
Re: Ask HN: Why no love for PHP?
#491) PHP isn't long-lived. Every time a request comes in Apache launches the PHP processor/interpreter and runs through the entire script. This means you don't get a heap that you can use to cache things[0], you don't get the benefit of JIT compilation, and you don't get the benefit of pre-compilation[1].
2) PHP development always seems to be tied tightly to a database. At some point an extremely high-traffic app will need to scale beyond what a DB (even a sharded DB) can support. To do this you have to think in terms of asynchronous processing, out-of-process updates, aggressive caching, and more.
The second point isn't really an issue of PHP, but more an issue of the PHP ecosystem - however, it affects the way I perceive the language itself.
Places that use PHP for high traffic sites seem to use it to build the presentation layer, which seems to work for them, but the majority of the work is being done by back-ends written in some other language.
[0] Yes, you can use memcache, but it still means, at the very least, a cross-process hop and most likely a cross-network hop.
[1] Compiling to bytecode (for Java) is still better than no compilation. Also, you only take the hit of starting the JVM once, not on every request.
Re: Ask HN: Why no love for PHP?
#50PHP has a few downsides, everything from poor naming conventions to security vulnerabilities. People around these parts are always looking for the cleanest solutions to their problems and the latest methods available. PHP's relative age and problems make it neither. That said, I coded my first startup in PHP. It's dead simple to make a dynamic web page with PHP, but it's also dead simple to create a huge mess. In tha…
Well said. I would recommend Django to people who prefer Python to Ruby.
That's why I am unsure about Zed Shaw at EuroDjangoCon. I love to have smart and capable people around, but Zed still has to prove he can play well with others.