PHPinking and the Brain

By Harry Fuecks

Via Sebastian, Kristian: Zend in the Clowns – a sceptical but ultimately positive look at PHP5 (while roaming over PHP4 and a whole lot more).

In asking “why?” when considering PHP5’s new, Java-like, capabilities the author comes to this “sinister Pinky-and-the-Brain” conclusion;

It probably isn’t putting it too strongly to state that PHP v5 represents a concerted attempt to break away from the role of ‘easy-server-side-scripter’, with competing in the role of an all-purpose, easy-to-program, generalized, cross-platform interpreted language being the ultimate aim. They’re not just borrowing syntax from Java; Long-term, they’re actually going after Java’s market niche, and Perl’s, and Python’s, and dotNET’s, and VB’s…

So what else would it take for PHP to grow wings and become a serious, general purpose language? Some things off the top of my head;

– Built in OPCODE caching (there has to be a better business model for Zend these days e.g. commercial extensions)

– Sterlings Abstract data types extension to mature

Threads by default

– A wrapper for wxWidgets

– Namespaces

– SAFE mode to become safe

– Better garbage collection? (have no evidence here but the anecdotal view is “long running” PHP scripts tend to hog memory – not a typically problem when using PHP with Apache)

– Something like Python’s psyco built in.

So far that’s not out of reach, given some serious manpower (i.e. cash) to get there.

Anything else?

  • Betcour

    Obviously… a virtual machine (where program and objects can remain persistents). That would have to be optionnal as this is very different from the current (and convenient) PHP paradigm of short-lived scripts.

    The danger is putting too much stuff and becoming more and more complex to use, and less and less easy for beginners. One of the reason PHP became very popular is that it’s easy and has a soft learning curve. Any evolution should not make the language harder to use (turning off register_global for example does make the language harder to use and was, IMHO, a bad move)

  • cyngon

    Am I the only one who things that PHP is off base in trying to incorporate a lot of Java’s OOP features?

    PHP is a dynamic, weakly typed language, and Java is a statically, strongly typed language. I strongly believe that putting strongly typed features into PHP5 (like interfaces and type hinting) will hurt PHP in the long term.

    I think I’ll stick to Python… a language without identity issues and multiple personalities. :)


  • nucleuz

    Well: you don’t *have to* incorporate the new features in you apps, PHP don’t force you to do either procedural or OOP, personally I recon these features really help in the development of rather large applications where there are team members working on various parts of the system ( and get a clean API that you have to follow ).
    The new features won’t come in the way of old programs ( they run quite nice ).

    For the new features part asked for: Pecl and Pear are good, but what I have always had in the back of my mind is the Java Community Program ( ), but for PHP. Having the larger companies and community that do PHP collaborate around API and specifications it would be a great help for the community itself ( I think this was discussed here at sitepoint at one point ).

    Just my .02$

  • Widow Maker

    I’m happy enough now that PHP has a half decent object model but following Javas footsteps as such as the JVM is a bad idea – that is not what PHP is all about.

    Having a virtual machine will destroy PHP in my view. We wanted an easy to use, expandable server side language, and we have it with PHP.

    Harry want to know how PHP can capture more market share ? Time – simple as that really. In another 3 years, there will be 2 choice to develop the internet with in my view,

    1) Java
    2) PHP

    DotNet will proberly still retain market share of course, after all it’s Microsoft ain’t it ? But business growth will be either Java or PHP as I see it.

    Or do people think I’m off the planet ? :D

  • jccapitalist

    Off the planet. Seriously though, .NET has already passed JSP’s in usage on the web, in its FIRST release (1.x)! Im thinking more of an ASP.NET and PHP dominance of the web. ASP.NET for Windows servers, and (generaly) PHP for Linux Servers. Pick ya flava!

  • andre

    well it’s not gonna be very long before we see apache on UNIX serving ASP.Net courtesy of Mono :) so PHP has to grow and improve. how has the parrot VM come along? is it getting *there*? will PHP likely be hosted in it (as expected for PHP6) ?

  • Anonymous

    Python has plenty of identity issues. For instance, old and new style objects.

  • DaSilentStorm

    Betcour, maybe I got you wrong, but there already is a Servlet Container pendant for PHP. It’s Vulcan Logics SRM. I didn’t had the time to test (or compile ;-)) it yet, but if it works as described, this might be the next big step towards PHP Enterprise Level Applications.
    Gimme all ya memory ;-)

  • Lukas

    the biggest one you missed:
    sandboxing … so that php can truley claim to be a template engine

  • hlellelid

    I think that PHP will have to do serious battle with dotNET if it wants to really target that market (which new OO features would suggest). I’ve done some stuff in C# with Mono+XSP on Linux and it is soooo nice. A beautiful hybrid of highly structured Java-style design with a bit more flexibility in C# (e.g. string indexed arrays like PHP, auto-boxing of primitives, generic types, method overriding, pointers if you need ’em). & the awesome thing is that it only took a couple hours to get up & running (never had such an easy time w/ Tomcat — not to mention a J2EE platform).

    If Mono can bring a stable & full-featured .NET platform to Linux, PHP is gonna have to fight hard to keep their market or re-target for the quick ‘n dirty market. Without things like namespaces PHP really lags behind. Finally exceptions at least!

  • Widow Maker

    Quick N’ Dirty market ? I hope not, still even today a lot of businesses have this perception of PHP and it’s something that has to change in my view.

  • godvin

    Namespaces is the general thing that lacks as far as I can tell. Other than that it would be nice if one could “compile” the code. I know there are accelerators/cache like MMT



Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Front-end, once a week, for free.