Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?

PHP 5 Released; PHP Compiler, Too 524

TheTomcat writes "After years of anticipation, PHP 5 was released today. This release represents a milestone in the evolution of PHP. It sports the new Zend Engine II, a completely re-worked object model, and many many new features. Check it and the changelog out." In other PHP news, remote_bob writes "There have been many attempts, like BinaryPHP and PASM, but finally there is a complete compiler for PHP. The Roadsend compiler produces standalone, native executables, and supports the entire PHP language (but not all extensions). It uses Bigloo Scheme to do its job, a variant of Lisp, the language that Paul Graham writes about. Benchmarks say that performance is pretty good. Is this another sign that dynamic languages are the future?"
This discussion has been archived. No new comments can be posted.

PHP 5 Released; PHP Compiler, Too

Comments Filter:
  • So it is out... (Score:3, Insightful)

    by Necromutant ( 656140 ) on Tuesday July 13, 2004 @06:46PM (#9691688) Journal
    ...but who will use it for another year or two?
  • Goodbye Perl? (Score:3, Interesting)

    by FyRE666 ( 263011 ) * on Tuesday July 13, 2004 @06:46PM (#9691691) Homepage
    This may well sever my last remaining link with Perl. While I used to ride the camel for web and shell scripting, I've now moved entirely to php for the web, and mostly php for shell scripting, with Perl used when its extra speed is useful. Presumably compiled php will eclipse Perl for scripting use now though, so (on Linux at least) I'll probably convert fully. Pity I have to stick with sed, awk and shell scripts on our old HPUX servers though...
    • Re:Goodbye Perl? (Score:5, Interesting)

      by KevinKnSC ( 744603 ) * on Tuesday July 13, 2004 @06:53PM (#9691748)
      I agree, this makes it hard to justify something besides PHP in a lot of situations.

      It's too bad the compiler is $399 per year, and only currently available on Linux. If it was a little less, and not licensed annually, I'd be uninstalling a lot of other development tools right now.

      • $399 per year for nothing more than a compiler puts it at roughly at the same price as the entire Microsoft Visual Studio... seeing that you get about 2-3 years out of the typical VS release.
    • Re:Goodbye Perl? (Score:2, Interesting)

      by defsdoor ( 737019 )
      I thought I was the only person that used php for scripting too. I've got a landline call rating system that runs superbly written entirely in php.
      It started out as a prototype but worked so well and fast that it stayed.
    • Re:Goodbye Perl? (Score:3, Insightful)

      by mentatchris ( 585868 )
      Perl is still an excellent option IMHO. For me, the most important feature of a language is the amount of support available. Perl has so much documentation scattered around the web, it's usually very easy to find an example or get help with a problem. Also, the books are now all on version 2+, meaning most of the bugs have been worked out. With my Safari access, I have years of resources at my disposal. While I appreciate all that PHP offers, I still haven't been convinced that it is good enough to make
      • Re:Goodbye Perl? (Score:4, Interesting)

        by FyRE666 ( 263011 ) * on Tuesday July 13, 2004 @07:29PM (#9691980) Homepage
        I don't think there's much of a learning curve going from Perl to PHP - the other way there would be though! PHP closely resembles Perl in many ways - it has certainly been influenced by it to a greater extent than any other language I can think of.

        I've been using Perl for around 10(?) years and while I appreciate its regex engine is faster than PHP, and the CPAN modules offer things PHP doesn't have (at present), you can put almost any web app together far faster with PHP than Perl. IMV this also goes for most database driven shell scripts.
    • Re:Goodbye Perl? (Score:3, Interesting)

      by xa0s ( 128789 )
      I'm a longtime Perl programmer, and while I've seen Perl having been taken over by PHP on the web side of things, Perl still sees enourmous use in generic *nix system world. For example, in the company I work for we use many programming languages on many architectures, and Perl has consistently been the duct tape that ties them all together. We even have a dedicated infratructure team that maintains the various releases of Perl and our core Perl APIs. I dont think Perl will ever completely die(), but it'
    • Re:Goodbye Perl? (Score:5, Insightful)

      by Christianfreak ( 100697 ) on Tuesday July 13, 2004 @08:17PM (#9692362) Homepage Journal
      Compiled PHP won't be much faster IMHO. If you want something compiled why don't you write your web apps in C? One of the main points about using an interpreted language is that your app can be changed quickly on the fly which is often nessicary in web development. Doubtful that people are going to start compiling PHP apps anytime soon.

      PHP for shell scripts? That's just strange. ick.

      PHP 5 still lacks namespaces, that alone is a good reason not to switch. That and CPAN (and no before you mention it, PEAR doesn't come anywhere close)

      Since I always get the same replies everytime one of these posts comes up I'll answer them all now.

      I use PHP everyday, its part of my job (sysadmin/web-developer). Have been using it for 4 years. At first I thought it was alright, but the more I've used it the more I loathe it. I find it inconsistant and I find at its core everything that goes against what a well designed language should be.

      Perl code is not ugly unless you make it ugly. You can make C or PHP ugly as well.

      Perl can be used in projects with multiple developers, I work with one other developer on a regular basis, sometimes two. At the beginning of the project we plan core modules and set APIs and coding style, much like I would expect anyone would do for any language.

      IMHO and experience mod_perl is faster than PHP especially in larger apps. /flame on
      • Re:Goodbye Perl? (Score:4, Interesting)

        by senzafine ( 630873 ) on Tuesday July 13, 2004 @09:41PM (#9692952) Homepage
        At my work we develop alot in PHP. Me and another co-worker started creating a repository of classes which we use like there's no tomorrow. We've gotten a really good system of consistent coding style. Though I can still tell what lines he's written and I've written. But they're formatted the same so a third developer can come in and understand it all as well.

        As far as PHP for shell scripting. I use it when I just need something quick. I'll sometimes go back and change it to a different language when I have time.

        To make a long post short...I'm estatic about php5 being released!
    • Seriously, I'm looking at and all that the eye can see is a nearly-identical syntax to Java. Classes, object cloning, Throwables, destructors, exceptions (albeit weak ones), statics... holy crap people, why not just switch to Java? It's all that PHP5 has and more.

      (Hurray for being modded as flamebait!)

    • Re:Goodbye Perl? (Score:5, Interesting)

      by blankslate ( 748549 ) on Tuesday July 13, 2004 @10:54PM (#9693387)
      I'm surprised with all this PHP vs PERL talk that no-one's mentioned that ZEND says [] you can use PERL from within PHP, as of release 5. Does no-one else find this highly interesting? Anyone tried it yet?
  • Let the PHP flame war begin!

    While I use PHP quite a bit, I think I'll wait a few months / versions befor deploying this...

  • Thanks PHP team (Score:3, Informative)

    by Dreadlord ( 671979 ) on Tuesday July 13, 2004 @06:47PM (#9691698) Journal
    Doing PHP development has been my main source of income for a couple of years, the new release will make my life much easier, especially the new OOP model, let's just hope that web hosts will upgrade soon.

    Thanks again PHP team!
  • PHP5 looks a lot cleaner than 4, at the expense of backwards compatibility. Some will probably make a lot of noise about this latter, but it's necessary when changing (improving) the language this much.

    Remember, nobody's forcing you to upgrade that site running perfectly well under php4, and you probably shouldn't.

    • by andig ( 139527 ) on Tuesday July 13, 2004 @06:53PM (#9691743)
      One of our design goals for PHP 5, was to keep backwards compatibility as much as possible. Actually most PHP 4 sites run out of the box with PHP 5. If there are problems, there's a compatibility mode (configurable via php.ini) which makes the object-oriented model behave the same as in PHP 4.
      Bottom-line: Very few people will have problems doing the upgrade. Of course you should thoroughly test your site before upgrading.
    • As far as I understand it, backwards compatibility was not sacrificed, perhaps given a couple of slaps in the face but most php4 sites should be able to run in a php5 environment.
    • by Sokie ( 60732 ) <jesse.edgefactor@com> on Tuesday July 13, 2004 @07:34PM (#9692009)
      A kind of slick way to test your existing code and applications is to do a little <IfDefine>-fu in your apache.conf and set it up so you have two instances of Apache running on different ports but using the same DocumentRoot. One instance running the PHP4 module and one the PHP5 module. I've got this set up on my Gentoo dev server with PHP5 running over port 8080. Just add an :8080 to the URL and your page is running through PHP5, I've found it quite useful for playing around and testing. If anyone wants more details just e-mail me. And if you're not using Apache, you can probably set up a similar thing, but I can't really help you there.
  • Cross Platform? (Score:2, Interesting)

    by blackmonday ( 607916 )
    How is the cross platform ability of PHP? Can I write an app un Linux and comile and run it on OS X and Windows? Does it need a runtime, or is it bundled? Seems like an intriguing alternative to .NET.

    • Re:Cross Platform? (Score:5, Informative)

      by Dreadlord ( 671979 ) on Tuesday July 13, 2004 @06:54PM (#9691756) Journal
      Yes the official interpreter is cross-platform, it is available for *nix and Windows.

      Check out the downloads section [] at for Windows binaries and *nix source, and here [] you can find more details on PHP under Mac OS X.

      As for the compiler in the story, I haven't tried it before so I don't know.
    • I personally know (mostly the hard way :P) that saying "It's all cross-platform! We promise!" doesn't always mean it *is* cross-platform.

      However, a few months ago I moved an (admittedly small) webapp from Windows apache to Linux apache, and the only change I needed to make was switching all my include backslashes to frontslashes. Which I should have done to start with, since frontslashes work on Windows.

      So that cross-platformability seems pretty reliable. :)
    • Re:Cross Platform? (Score:4, Informative)

      by man_ls ( 248470 ) on Tuesday July 13, 2004 @07:20PM (#9691924)
      Very cross-platform...obviously some things like file paths might have to be changed to reflect the filesystem they run on top of (/usr/bin/whatever vs c:\program files\whatever) but with few exceptions, PHP code written on any OS will work on any other one.
  • by ChipMonk ( 711367 ) on Tuesday July 13, 2004 @06:48PM (#9691713) Journal
    Is this another sign that dynamic languages are the future?

    I'm starting to think there are no new ideas any more, just re-hashes of old ideas. Unix, almost 35 years old, looks to be once again the wave of the future. LISP is still teaching us lessons. And the command line is still the most powerful sysadmin tool we have.
  • PHP5 (Score:5, Interesting)

    by mfh ( 56 ) on Tuesday July 13, 2004 @06:49PM (#9691717) Homepage Journal
    Some folks were suspicious of PHP5, and being a longtime PHP programmer, I am very pleased with the changes and additions in PHP5. Can't wait to test it out. Personally, I'm not sure if I'll use *all* of the new stuff, yet I'm sure I'll have to play with the coolest additions for the hell of it, and sort out what I'll be using and what will remain vestigial in my scripts. I will add that some of the previous PHP version quirkiness seems to be fixed.

    I am certain this is not the last we'll hear about PHP5 on Slashdot, yet I am only hoping that it's creative/cool stuff, and not security problem/exploit stuff.

    I can't wait to see what kinds of changes I can make to my content management system [] that PHP5 will bring.
  • PHP Object Model (Score:3, Interesting)

    by Eberlin ( 570874 ) on Tuesday July 13, 2004 @06:54PM (#9691760) Homepage
    A good reworking of the PHP object model was definitely in order. Inheritance was a bit weird, destructors were odd to work with, and there weren't ways to declare stuff private.

    The bigger question is compatibility. Will older code be ok? When will mainstream hosts migrate to the newer version? It'll be scary to find systems borken because of version updates.

    As for a compiler, I'm not sure I'm comfy with the idea. Always figured if you wanted to write code for native compilation, you'd hack in C or maybe C++. Not that PHP wouldn't have its PHP is really handy and greatly increases the speed of development.
  • by MisterJones ( 751585 ) on Tuesday July 13, 2004 @06:54PM (#9691761)

    $400 for the license, which is only good for one year. After that, it won't compile until you renew.

    Doesn't seem worth it for the casual hobbyist...
    • Yow. For that price it doesn't seem worth it for *anyone*.
  • Compiled vs Cached (Score:5, Interesting)

    by chill ( 34294 ) on Tuesday July 13, 2004 @06:55PM (#9691774) Journal
    If speed and not closed-source is your main consideration, then how does the Roadsend compiled code stack up against interpreted code fed through the Zend Accelerator, the Turck MMcache or other caches?

    mmCache is OSS and free (as in beer), which is a big plus in my book.

  • $$ for compiler (Score:2, Interesting)

    by hkb ( 777908 )
    Uhm, the compiler is priced at a low, low introductory price of $399. I don't think it'll be taking the *NIX world by storm any time soon, or cause mass adoption to PHP executables anytime soon.
    • Re:$$ for compiler (Score:3, Informative)

      by NoMercy ( 105420 )
      Well that makes it pretty worthless.. on a plus side if they sell it there's likely support and other features which would make php more of a option in business.

      And if they can do it, why can't we... how long till GCC compiles php code?
      • Well that makes it pretty worthless.. on a plus side if they sell it there's likely support and other features which would make php more of a option in business.

        Not really. Most people interested in compiled PHP are working in the "enterprise" market. $400 for a commercial compiler is not that bad.

        And if they can do it, why can't we... how long till GCC compiles php code?

        I think most people who have the skills to write something like a compiler generally want to make a living from their work, hence the

    • Re:$$ for compiler (Score:5, Interesting)

      by prockcore ( 543967 ) on Tuesday July 13, 2004 @07:25PM (#9691961)
      Uhm, the compiler is priced at a low, low introductory price of $399. I don't think it'll be taking the *NIX world by storm any time soon, or cause mass adoption to PHP executables anytime soon.

      The price is nothing. If you're running a site that requires compiled PHP, $399 is a joke. The thing holding the compiler back isn't the price, it's the lack of Solaris support.
  • Awesome! (Score:3, Funny)

    by Anonymous Coward on Tuesday July 13, 2004 @06:58PM (#9691788)
    Now that PHP has stopped imitating Perl, and started imitating Java, I can write some Java-look-alike code while still simple-mindedly sneering at that language as inefficient and bloated!
  • by z0ink ( 572154 ) on Tuesday July 13, 2004 @07:05PM (#9691834)
    For those who are not new to php, but wan't a good primer for PHP 5 I would definatly recommend this book [] by George Schlossnagle. Advanced PHP Programming was recently reviewed here [] and it was upon reading that review that I decided to pick up a copy. It serves as an introduction to OOP to those who are unfamiliar and does a good job in covering the specific mechanics of how things operate in PHP. The book even includes some good info on some Zend Engine hacking.
  • And the compiler is only $399.00! And it only runs on x86, no Sparc, no AMD64, no PPC and no S/390 support!

    What a deal, what a deal!

  • by abes ( 82351 ) on Tuesday July 13, 2004 @07:10PM (#9691862) Homepage
    I used to really be into PHP. It was great for creating a webpage in little or no time. It's syntax, while maybe not perfect, was pretty good. Until, that is, I tried to start developing my own libraries, and ran into weird quirkiness with object design, and trying to figure out the best way to do libraries, etc. It looks like PHP5 might fix the problems I had with how objects worked, and I'm not sure if it was my own fault with the messy libraries I ended up with, or whether I didn't find the best way to do it in PHP, but I eventually moved to Python out of frustration.

    I had avoided Python for a long time, as I really disliked (and still do) the indentation-matters issue. But besides that, and its own set of quirks, it's a really great language, and for larger projects I have trouble even thinking about going back to PHP.

    I think the biggest selling point to PHP over other solutions such as Python is that its simple. You don't have to make a whole of choices. For example, with Python you have a large number of packages to choose from: Zope, mod_python, twisted.web, Python CGI, and a bunch of variants on these. While choice can be good, it can also be overwhelming (like how do you know which package to go with until you've tried them all?).

    I think I am not alone with some of difficulties I faced with PHP. So while it's great to hear that PHP has fixed many of its bugs, I think its worthwhile for people to also look at other solutions out there.

    Just my $0.02.
  • IonCube (Score:3, Informative)

    by JohnnyBigodes ( 609498 ) <> on Tuesday July 13, 2004 @07:11PM (#9691868)
    Speaking of PHP compilers, there's a good and very affordable solution from IonCube [] as well.

    (no, I have no affiliation to them)
    • Re:IonCube (Score:3, Informative)

      by mdfst13 ( 664665 )
      That's not a compiler in the same sense; it's an encoder. It allows people to store PHP scripts as a proprietary code (it's actually a lot like java). A true compiler creates native machine code.
  • by TiggertheMad ( 556308 ) on Tuesday July 13, 2004 @07:13PM (#9691881) Homepage Journal
    ...does the FBI know about this? I have heard about some of the PHP busts in recent years, but all this talk about how 'powerful' this new PHP is makes me wonder how dangerous it is. It sounds expensive, too. I hope that this doesn't lead nice young kids, into a life of crime. Imagine, hords of young, glassy-eyed kids stealing stuff games and movies just to fund their PHP habbit.

    Damn kids.
  • Dynamic languages? (Score:3, Interesting)

    by JessLeah ( 625838 ) on Tuesday July 13, 2004 @07:14PM (#9691884)
    What the heck does that mean? Is that a fancy way of saying "Compiled languages"? (I somehow doubt it) What precisely is meant here? Is a dynamic language "a language that can be either compiled or interpreted"?
    • by Waffle Iron ( 339739 ) on Tuesday July 13, 2004 @07:41PM (#9692071)
      Dynamic language usually means "dynamically typed". This means a typed language that associates type information with data values, not with variables. (i.e, the language keeps track of types, but any variable can hold a value of any type)

      Sometimes, it also implies things like dynamically extensible type definitions at runtime, automatic memory management, and support for various functional-style features such as closures.

      Compiling a dynamic language to machine code is usually a challenging problem.

  • PHP 5 Tutorials (Score:4, Informative)

    by aint ( 183045 ) on Tuesday July 13, 2004 @07:17PM (#9691912)
    For a list of PHP 5 related tutorials and articles check out this faqt [] or simply look around the faqts PHP 5 section [].
  • by andig ( 139527 ) on Tuesday July 13, 2004 @07:20PM (#9691925)
    If you'd like to see what's new in PHP 5, we got some of the leading PHP developers to write about new extensions they developed.
    I also posted the first chapter of my PHP 5 book in that section which gives an overview of what's new in PHP 5. This book will be part of the Bruce Perens series of Prentice-Hall and will therefore be open-source and freely accessible to anyone.
  • by Animats ( 122034 ) on Tuesday July 13, 2004 @07:24PM (#9691958) Homepage
    LISP is a good match for operating on HTML and XML, both of which are really tree structures. Operating on trees works very well in LISP. That's what it's good at. Perl, PHP, and Java don't do trees well. You have to hammer the tree into an object paradigm, which doesn't help all that much. Perl's representation of a tree is rather inefficient, too. I do considerable parsing of large documents into trees in Perl. It works, it's portable, it's slow, and Perl is badly matched to the task. PHP is worse.

    LISP's parentheses turn everybody off, including me, but the data structures really are a win for tree-like applications.

    • A lot of folks have no problem migrating from f(a, b) to (f a b). In fact, a lot of people don't find the migration from 2+2 to (+ 2 2) all that hard. I use Scheme all the time and like it.
  • by heyitsme ( 472683 ) on Tuesday July 13, 2004 @07:27PM (#9691971) Homepage
    Dynamic languages the future? Unlikely. The future of programming is more likely in code that isn't written, but rather "drawn"

    Many people haven't heard of LabView [], even though it has been around since the late 80s. It runs on Windows, Mac OS, and Linux. The premise behind LabView is there is no such thing as written code. Instead of code, applications are literally drawn by dragging variables (controls, indicators) onto the block diagram and wiring them together. For instance, if I wanted to add 1 and 2, I would create two integer objects with respective values, find the addition function, and wire them together to an output (indicator - think text box). I have written entire graphical application suites/analysis tools in a matter of days and weeks instead of months (had I written them in, say, C or Java or $your_texT_based_language_of_choice).

    The only issue many will have with LabView is that it is expensive. It is also closed source, but hey, so is Java. Anyone interested in rapid application prototyping/development or digital/analog instrumentation should check out LabView.

    • Many people haven't heard of LabView, even though it has been around since the late 80s.

      Maybe, just maybe, there's a reason for that.

      While "graph" programming may be useful for data flow programming, it's absolutely useless for general purpose programming. For general purpose programming the devil's in the details and introducing a "graph" programming language just moves you further away from the details without actually giving you control of the details (see Joel Spolsky's article about "leaky abstractio

    • Dynamic languages the future? Unlikely. The future of programming is more likely in code that isn't written, but rather "drawn".

      This has been coming up regularly since the 80s. I've seen apps like this, and even tried writing my own version, and recently there was a fad for UML->code compilers. The fact is that it's not going to happen. It's far quicker to type than it is to draw. Also you can fit a lot of code on one page making it easier to debug, as opposed to scrolling through vast screens of visu
  • Unicode Any Better? (Score:3, Interesting)

    by ThatDamnMurphyGuy ( 109869 ) on Tuesday July 13, 2004 @07:55PM (#9692206) Homepage

    PHP is dead. Long live PHP!

    Now that I have that out of my system. Does anyone know if PHP5 Unicode is any better than PHP4?

    Admittedly I've done about 10 total minutes of PHP coding in my entire life, but I do follow it as closely as possible when I'm not thinking about Perl. I always got the impression the Unicode working in PHP4 was a little lacking compared to the latter versions of Perl.

    For example: PHP does have limited unicode support [] and Joel on Software [].

    • PHP and Unicode (Score:3, Informative)

      by UnConeD ( 576155 )
      The basic summary is, PHP does not support Unicode or any other encodings properly. PHP strings are 8-bit-per-character and do not have any explicit encoding. Sure, there is a multibyte string extension available, but when you look at the big picture, it's worthless.

      The reason is that PHP's biggest strength is that these days, you can get a PHP-enabled host for virtually no money. However, most of these installs run a standard PHP, some even a locked down one.

      The consequence is that anyone who wants to de
  • I hate to say it.... (Score:3, Informative)

    by Anonymous Coward on Tuesday July 13, 2004 @08:12PM (#9692321)
    ...but Microsoft really did get there lightyears ahead of this, with a far more complete class library and a standardized language, as well as a scripting engine that supported true seperation of code, presentation and so forth.

    Just to clarify this, consider the following:-'s been precompiled since the 2000 beta, and it's been production ready for years. The C# language is also fully documented and is a public standard ratified by the EMCA.

    PHP5, however nice, is treading old water, and in terms of functionality is still lagging behind even Java/JSP. The whole reason I'm assuming people stuck with PHP4, rather than move to something more robust that provides this kind of capability, is that:-

    1) They're apathetic about new technology.
    2) If the old language does what they want, why upgrade. It's *Personal* Home Page, after all, not corporate homepage.
    3) Why make things more complex, for very little benifit.

    Performance wise, the compiled version advantages are fairly insubstantial, and 99.9% of the new stuff they've added could have been done in other ways using the existing language.

    The whole thing seems pretty stagnant, and I'm guessing there's a small chance that the PHP guys are stuggling to find their own space between the land of true pre-compiled OO languages and the interperated world that lay behind it.

    I've worked with PHP4 and since both of them were betas, and if PHP wants to be a serious consideration for large scale development, it'd better decide which side of the OO fence its on, and stay there.
    • by Synn ( 6288 )
      1) They're apathetic about new technology.
      2) If the old language does what they want, why upgrade. It's *Personal* Home Page, after all, not corporate homepage.
      3) Why make things more complex, for very little benifit.

      You forgot:

      4) Because it works.

      I've been the admin for Apache/PHP servers for close to 6 years now and I've not ever had PHP cause a single crash. You can have complete idiots writing PHP scripts and you don't have to worry about them taking down you're entire server with a bad piece of cod
  • by Theovon ( 109752 ) on Tuesday July 13, 2004 @08:16PM (#9692350)
    This makes me wonder if the PHP programs have to be manually compiled, if they can be compiled JIT, or if a compiled version can be cached and only recompiled if the original PHP source changes....
  • SOAP (Score:3, Interesting)

    by Tobias Luetke ( 707936 ) * on Tuesday July 13, 2004 @09:54PM (#9693050)
    Its definatly an awesome release. I'm thrilled by the native SOAP support.
    Hard to imagine what the OS crowd will do with a blockbuster feature like this generally available. SQLite will improve the xcopy deployment compatibilities of simpler apps and SimpleXML is the best xml API i have seen so far in any language. On the OOP front we get exceptions which will finally unmangle the error systems of most complex php web apps which usually accounted for a big chunk of the code.

    Anyways, php is cutting edge again.
  • by keepper ( 24317 ) on Tuesday July 13, 2004 @11:14PM (#9693474) Homepage

    I see so many posts about how this would make them switch from perl to php.. but perl has had this for ages...

  • by FoboldFKY ( 785255 ) on Tuesday July 13, 2004 @11:21PM (#9693506)

    ...but for some reason I'm rather disinterested.

    Don't get me wrong; I've been doing PHP coding for a while. But the fact of the matter is that the more I code in PHP, the more I dislike it.

    Granted, the new OOP features in PHP5 are a good thing; hell, they should've been in there a LONG time ago. And exception support has me jumping for joy.

    But where for the love of all that is holy is support for namespaces? I mean, sure PHP has a ton of really handy extensions, but I am getting so sick to death with typing underscores that I'll be happy man if the world suddenly decided that underscores were bad and removed them from all character sets (oh, and keyboards) entirely.

    And I've also come to the conclusion that the standard PHP api can't quite make up it's mind whether it's supposed to be emulating C, or maybe some other language. Some array functions are prefixed by array_. Some aren't. Some have their arguments in the reverse order that almost all the others do. It's a mess.

    PHP is a nice language, good for beginners. But it's complete lack of namespaces, half-arsed support for functional constructs (damn I hate having to write callback functions out seperately when they're one liners!), and schizophrenic api are slowly pushing me towards more well thought-out languages like Python.

    Sure, Python's "thou shalt indent" system annoys me a lot of the time, but other then that it's just a clean, logical language. Unfortunetly, support for it on web hosts seems to be all but non-existant.

    Seriously, if the PHP devs really want to bring PHP up a few notches, they need namespaces, and to standardize the API naming conventions. I shouldn't have to constantly open up the PHP manual to work out whether the array sorting function has array_ out the front or not.

    Still, it's a nice set of improvements, so credit where credit is due. Kudos to the PHP team.

  • dynamic languages (Score:3, Interesting)

    by dekeji ( 784080 ) on Wednesday July 14, 2004 @01:38AM (#9694226)
    Benchmarks say that performance is pretty good. Is this another sign that dynamic languages are the future?"

    No more and no less so than they have ever been: dynamic languages are a good choice for many, but not all applications. And dynamic languages have been enormously popular for decades, with far programmers using them than using static languages; PHP just follows in that tradition.

    What is more interesting is the emergence of dynamic languages which use static type systems by default: in their runtimes, Java and C# have more complete and better defined dynamic features than Lisp, but they still give the user a simple static type system by default. It remains to be seen whether that gives you the best of both worlds or the worst. Fortunately, their runtimes are well-defined enough that one isn't limited to the specific choices that the currently popular languages running on top of them have made.
  • by scrytch ( 9198 ) <> on Wednesday July 14, 2004 @10:25AM (#9696557)
    I remember putting a CMS together with PHP4, something like Midgard, but pure PHP with multiple backends. It's not entirely a bad design even now, though I think Zope has a better answer.

    I ran into some awesomely dumb stuff. I mean "what are they smoking" stuff.

    Brain dead parser: First of all, this requirement to put everything in tags or whatever brackets you have defined. What is this, javascript? (and even javascript doesn't need it if you use src="foo.js"). That alone, not so bad, but the parser would easily choke on any end bracket construct ANYWHERE -- in a string, in a comment, etc.

    Flat namespace. OOP completely unused in extensions. Since PHP can easily call functions dynamically by name, and we have PEAR now, I consider the problem solved. No worse a hack than perl's OOP implementation, really. But I had other problems with OOP...

    Pass-by-value: PHP4 would pass objects by value. Which is actually great if I want such value-type, but 99.9% of the time, I don't. What made matters worse was PHP's twisted notion of object identity -- it had no operator to test it. Equality comparison operators were always by value, and either "shallow" or "deep". I had to explain the concept of object identity, and for my trouble, got the '===' operator ... which did exactly the WRONG thing and implemented even DEEPER comparison. That was the point where I went over the edge and wrote off PHP. I hear this behavior has mercifully changed to a sane one in PHP5.

    Second-class-language attitude: I got choice responses from Zeev himself about how PHP is never intended to be more than a "web language" (apparently meaning limited to trivial scripting, because the web apps I use sure aren't trivial). PHP can be and has been used for powerful things, but I don't see writing a caching bulk DNS lookup service that tests against multiple RBL's using PHP if I can't get a serious contender to Net::DNS because PHP is "merely a web language" after all. I used Perl for that, then switched it to Python (stackless was ideal for this job) and then dropped it into the object publisher in mod_python. Painless. There is no such thing as a "web language", behind every web app there should be a *real* language.

    Error handling: Nonexistent. Got an error, it would print a traceback to the output if you were lucky. Syntax errors would simply die without any useful diagnostic. No eval (well there is, but it would also just die on syntax errors). I've seen structured exceptions in C, but PHP's was awful. Awesomely brittle.

    Hopefully PHP5 is migrating most of these warts away from PHP4. Perl certainly still has its own problems (mod_perl 2.0 is still not in a stable release state) so it's not too late for PHP among current perl users.

"Never face facts; if you do, you'll never get up in the morning." -- Marlo Thomas