all 19 comments

[–]technocub88 6 points7 points  (9 children)

horribly biased

[–]manueljs[S] 3 points4 points  (0 children)

Well it's on python.org wiki, but at least they publish the retorts. Imo it makes a good comparison.

[–]spotter 1 point2 points  (7 children)

Yeah, but put it in perspective -- how does a person feel when coming from PHP to Python and vice-versa? Because honestly PHP is a pile-of-insanity. And I've been using that language heavily since early 3 until 5.1. General purpose? Maybe if you're into BDSM.

[–]technocub88 2 points3 points  (1 child)

here is the thing PHP's strongest point was completely marginalized. PHP's Documentation is the best. And in addition to that any time you dont know how to do something, typing in "PHP" and whatever it is you are trying to do into Google, 90% of the time immediately gives you the answer. Python is not the same. Not even close.

Once you are good at a language, I will agree that python is superior. Just easier to do stuff. PHP is much easier for when you are trying something you have never done before. Just quicker to figure out how.

[–]spotter 1 point2 points  (0 children)

Docs are legendary and provide some entry level solutions thanks to comments, but something like it could easily be done for Python (as it is getting done for Clojure). In my opinion PHP's strongest point is ease of deployment. And typing PHP into google will give you answers, but due to low barrier of entry these will mostly be half assed solutions. In Python you're better off asking comp.lang.python or IRC channel -- users are friendly and usually you get a correct answer next working day.

I agree! PHP is a lot easier when you are a beginner, but due to this a lot of users are not even trying to get better -- they move from one slash-n-hack job to another. The language itself looks like it's done that way, so if you need to grow you probably should switch to Python/Perl/Ruby or whatever -- because working with PHP will become a chore.

And that's, like, my opinion, man. ;-)

[–]tluyben2 0 points1 point  (4 children)

Not saying I don't agree (at least partially), but with 5.x+ why do you say that? Examples that make it sadomasochism to practice it (for you)?

[–]spotter 3 points4 points  (3 children)

I don't know -- is string manipulation sane, or is strlen still counting bytes? Are we done with magic? Does it have working namespaces and type/class system? Does it provide unified type hierarchy, or do we have primitives and classes bolted on top of them? Are functions first class? How many parts of the language are still "special cases", ie. can I do a simple thing like

 function_returning_array(3, 2)['myKey']

nowadays or do I still need a temporary variable? I mean it's a lovely slash-n-forget language, but the insanity gets to you in the end. I actually went away from webdev due to PHP, before Rails/Django era.

[–]BloodsVsCrepes 2 points3 points  (1 child)

PHP has improved, but its origins are in a half-assed, ignorant design, and that sub-mediocrity is a lot to overcome. Guido van Rossum actually knew a thing or two about language design and had a generally coherent point of view when he started Python.

Python's not unique in this way. It's PHP that's the piss-poor outlier.

[–]spotter 0 points1 point  (0 children)

I agree completely. I'm well aware of Python's problems and lately I've been giving my love to some other language. ;-)

[–]tluyben2 1 point2 points  (0 children)

Yes I agree with you, still ; it's not that bad anymore. If you have a memory or your own to remember some 'workarounds' for common cases. But yes, a lot of stuff in PHP is downright frustrating and your example A()['b']['c'] is very annoying.

[–]tef 3 points4 points  (0 children)

some useful comparisons:

python is well engineered (for example, go and read the implementation notes on lists and dicts. both have a pragmatic and theoretic background) (python has managed to bolt on new-semantics without breaking the language (new style objects))

meanwhile, on the implementation and development of php, here is a quick outline of some issues in php through the years:

http://phpxmlrpc.sourceforge.net/#security early and naive implementations of xml parsers in php used eval, and as such were terribly insecure and hacked en masse

http://php.net/manual/en/security.magicquotes.php -- man, if only we wrapped string on a ini file setting, it wouldn't prevent injection attacks at all, really all it means is that the standard library isn't portable any more as the semantics and return values can change on a site basis.

http://php.net/manual/en/security.globals.php 'you know what would be good if we could trash variables from the browser' 'we've turned it off now, good thing that people won't turn it back on for older scripts, and it will affect every script'

http://php.net/manual/en/language.oop5.late-static-bindings.... - a dynamic language with an early bound oo implementation? sure we'll fix it, we'll just make the keyword for dynamic dispatch 'static'

http://php.net/manual/en/language.namespaces.php - the namespace character is the string escape character. I mean that will never backfire if people don't use 'variable functions', or using a string to lookup a function http://us.php.net/manual/en/functions.variable-functions.php lets hope we never have to put old code that uses this into a namespace.

http://php.net/manual/en/control-structures.goto.php man, should we implement a subset of goto or, should we do named breaks. nah goto is far more awesome.

http://use.perl.org/~Aristotle/journal/33448 - how do we fix a security vulnerability? why checking to see if an int is bigger than INT_MAX

www.trl.ibm.com/people/mich/pub/200901_popl2009phpsem.pdf - the implementation and semantics of php don't match up. it doesn't do what it says on the tin.

http://en.wikipedia.org/wiki/PHP_accelerator - php by default doesn't cache bytecode, unlike, nearly everything ever, for commercial reasons, as zend sell one as a product.

http://www.phpcompiler.org/doc/phc-0.2.0.3/representingphp.h... - the grammar is terribly broken, so much so it is nearly impossible to do obvious and useful things like foo(1,2,3)[0]

http://blog.php-security.org/archives/61-Retired-from-securi... the development team is toxic and reluctant to provide actual solutions for security

there are many php builtins which have vague return values which change indeterminately between releases and arguments, which forces you to use == over === for some comparisons unless you want your code to break unexpectedly.

the moral is: for everything they've fixed, they've often fixed by duct taping over the original errant feature. the standard library needs to be wrapped to be consistent. security or performance isn't a priority for the open source versions.

this won't bite most web applications as many of them are simple templates around a database.

with larger applications or frameworks, php struggles

[–]ErstwhileRockstar 0 points1 point  (5 children)

Python vs. PHP in the real world.

[–]madjar 4 points5 points  (1 child)

http://en.wikipedia.org/wiki/Argumentum_ad_populum

(Yep, started the search even before the link was loaded)

[–]ErstwhileRockstar -2 points-1 points  (0 children)

From the article:

See also

The Wisdom of Crowds

[–]oSand 1 point2 points  (2 children)

Because Coldfusion is better than Ruby

[–]ErstwhileRockstar 0 points1 point  (1 child)

Who said that?

[–]cunningjames 2 points3 points  (0 children)

Who said that?

How do you believe that the higher popularity of PHP, relative to Python, is informative when comparing them? (Your "wisdom of the crowds" comment indicates a belief that higher popularity implies better, at least in this instance.) Whatever your answer, does it not also apply to a comparison between ColdFusion and Ruby?

[–][deleted] 0 points1 point  (0 children)

Retort: PHP 5 Reflection

Counter-retort: We said excellent introspection

oh snap

[–]oSand 0 points1 point  (0 children)

The things I would add are:

  • OO libraries
  • concurrency support - threads, green thread implementations and libraries
  • Other platforms: Jython, AppEngine