Slashdot Mirror


Professional PHP4

Henry Birdwell contributes the following review of Wrox Press's Professional PHP4. Read on for his impressions, and to see if this book is right for your own dynamic web programming tasks. Professional PHP4 author Luis Argerich et al pages 975 publisher Wrox Press rating 9 reviewer Henry Birdwell ISBN 1861006918 summary Comprehensive print resource for working PHP programmers.

PHP is an open source server-side HTML-embedded web scripting language for creating dynamic web pages. Outside of it being browser-independent, PHP offers a simple and universal cross-platform solution for e-commerce, complex web, and database-driven applications. Professional PHP4 will show you exactly how to create state-of-the-art web applications that scale well, utilize databases optimally, and connect to a backend network using a multi-tiered approach.

Almost an year since its release, this book has stood the test of time, and proved to be what it promised -- an up-to-date, advanced book on PHP -- a category in which there are very few worthwhile entries to date.

It provides a solid, fast-paced drill on the rudimentaries of PHP (although the fast-paced installation instructions come in the form of classic compendia -- worth 100 pages) for seasoned programmers, before it plunges head straight into the more advanced areas of the language. Each chapter reads a bit like a tutorial on a particular area of advanced PHP development.

If you are a competent programmer in just about any other language or have grappled with HTML before, then this book will teach you PHP from scratch . It will also introduce you to many of the more advanced areas of PHP programming, and is a treasure trove for information on diverse tasks possible with the language.

Notable topics include:

  • Object Oriented Programming
  • Sessions and Cookies
  • Coding an FTP Client
  • Sending and Receiving Email and News
  • Networking and TCP/IP
  • Non-Web Programming (including GTK)
  • PHP and XML
  • PHP and MySQL/PostgreSQL/ODBC
  • Security
  • Multi-tier development
  • Optimisation

The code for the examples presented in the book is available for download, from the publisher's web site.

Although this book is reasonably complete, it lacks sufficient depth for experienced PHP developers who want to wade into the depths of specific PHP related tasks. Having said that, the publisher has provided information (of course at a separate cost) on specific areas with their second level PHP titles -- Professional PHP4 XML , Beginning PHP4 Multimedia Programming , Beginning PHP4 Databases and Professional PHP Web Services .

Suffice to say that the book has packed together a lot of diverse information (in 975 pages).

Related Links You can purchase Professional PHP4 from bn.com. (You may also be interested in the Slashdot review of Professional PHP XML of a few months ago.) Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

227 comments

  1. Oh no by Lordrashmi · · Score: 0, Flamebait

    Its time for another PHP vs. J2EE vs. .NET vs. PERL vs. everything flame war...

  2. PHP5? by Synn · · Score: 3, Interesting

    Does anyone have links to news/features on what's supposed to be in PHP5? I've been hearing rumors that it's going to be much more object oriented and easier to do serious design work in.

    1. Re:PHP5? by Lordrashmi · · Score: 5, Informative

      There is a paper on the ZEND engine 2.0 (which will power PHP5)
      PDF: http://www.zend.com/engine2/ZendEngine-2.0.pdf

      I would put the google HTML version of it, but it seems to be buggered.

    2. Re:PHP5? by Midwedge · · Score: 2, Informative

      At www.zend.com/zend/week/week114.php

      It says:

      PHP 5 not yet scheduled The number of messages to the list requesting some sort of schedule or arrival date for PHP 5 seems to be steadily growing. Please note that there are yet no dates for anything to do with PHP 5, and there still may be a whole new PHP (4.4) before the road to 5 officially begins. If there are any announcements to be made you will find them on either the main PHP web site (www.php.net) , or they will be covered here in this summary (I promise!).

    3. Re:PHP5? by mrobinso · · Score: 1

      In relation to PHP, OO is a programming style, not the underpinning of the language. PHP's strength is its simplicity, and the OO style rarely lends itself to simplicity for the average Joe.

      PHP5 will expand on the OO abilities of the language, public and private members, overloading (which is experimental in php4), etc.

      It might be worthy to note whats NOT going to be in PHP5, and thats the cruft extensions that have bloated it out to a 4MB+ download. Many of the extensions, except for the core stuff, will be moved to PECL.

      Also noteworthy is the advance of the PHP CLI, allowing use of the language in a more generic way with php based shell scripts. While this is available as EXPERIMENTAL in 4.2.3 and makes its stable debut in 4.3, I think it'll take off quite a bit in PHP5.

      Mike

      Ok ok, I'll be good. Gimme back my karma.

      --
      -- Karma whore? You betcha. --
    4. Re:PHP5? by tolan-b · · Score: 3, Interesting

      Yes it's going to be much more object-oriented.
      Handy stuff like:

      +passing by reference by default (rather than having to prepend ampersands all over the place)
      +multiple inheritance (i don't think this has been confirmed yet, personally i'd prefer something like java's interfaces, but that's because i love java ;)
      +private member vars (again not confirmed yet afaik)
      +static member vars
      +exception handling! yay!
      +deletion of objects that are still referenced (optional of course ;)
      +dereferencing of returned objects
      +object cloning
      +destructor methods

      and.. well loads more, but if you want lots of detail go read the pdf ;)

      all quite exciting if you ask me. the one thing that has always frustrated me about php is it's partial OO support, and I think this will go a long way to fixing that. i can't wait.

    5. Re:PHP5? by eguanlao · · Score: 1
    6. Re:PHP5? by vladkrupin · · Score: 1

      You can use Zend2 already - no need to wait till PHP5. Just check out the Zend2 tree from CVS instead of the current Zend, and off you go :)

      --

      Jobs? Which jobs?
    7. Re:PHP5? by eddy+the+lip · · Score: 2

      I've been trying to dig up info on the efficiency of using references in PHP4. The best I've come up with is "it depends, benchmark", which is good advice and all, but it's a bit counter-intuitive. I would have expected references to be generally more efficient. Somewhere in my searchings I came across a post by [one of the core PHP developers] that said something to the effect that references were very rarely more efficient, and in the next PHP release you should almost always avoid them unless you needed them for some other reason. I naturally forgot to bookmark it.

      Anyway, do you (or anyone else out there) have a helpful clue to share>

      Thanks....

      --

      This is the voice of World Control. I bring you Peace.

    8. Re:PHP5? by mackstann · · Score: 2

      php4 is pretty good at cli stuff. if you know php well, and dont know perl or python well, you can still make useful shell scripts easily.

    9. Re:PHP5? by Anonymous Coward · · Score: 0

      http://www.techweb.com/wire/story/TOE20021204S0001

      "PHP version 5, expected to appear in beta form by March, 2003, and released in the summer of 2003, could change all that. Significant performance improvements and a much more complete object-oriented programming environment will allow PHP to provide a powerful Web front end for enterprise-class .NET and J2EE-based applications."

    10. Re:PHP5? by Tablizer · · Score: 1

      supposed to be in PHP5? I've been hearing rumors that it's going to be much more object oriented and easier to do serious design work in.

      Some of us anti-OO people find these mutually exclusive :-P

    11. Re:PHP5? by Anonymous Coward · · Score: 0

      Does anyone have links to news/features on what's supposed to be in PHP5? I've been hearing rumors that it's going to be much more object oriented and easier to do serious design work in.

      Goddammit! They have to go and fuck everything up with this haughty OO shit! Is there NOWHERE to hide?

    12. Re:PHP5? by tolan-b · · Score: 1

      no benchmarks im afraid, but anecdotal evidence seems to suggest there's not a huge difference in terms of efficiency.

      i think the real issue is in terms of coding style, passing by reference is just more OO, and seems more intuitive to me.

  3. PHP5 soon, no? by Strike · · Score: 1, Insightful

    Isn't this book review a tad bit late considering that PHP5 is going to be hitting the 'net soon?

    1. Re:PHP5 soon, no? by mrobinso · · Score: 2, Informative

      I doubt PHP5 will be available any time soon. The 4.3 branch is in a release cycle now (RC3). The Zend engine 2 is very much an alpha work in progress.

      I would think a stable release of PHP5 is still quite a ways off.

      Mike

      Ok ok, I'll be good. Gimme back my karma.

      --
      -- Karma whore? You betcha. --
    2. Re:PHP5 soon, no? by aGeMo · · Score: 1

      Actually a beta of PHP5 is expected in March of 2003 and then the final to be released in summer of 2003. Read here for the full story.

    3. Re:PHP5 soon, no? by vladkrupin · · Score: 3, Interesting

      It's not hitting the net anytime soon.

      PHP 4.3 is still in the midst of release cycles, and things aren't perfectly smooth, as always. Chances are it won't be out for another few weeks (a month or so is probably a safe guess)

      PHP5 will be ready... well, when it's ready. Nobody even started thinking what should go into PHP5 yet. Aside from Zend2, which you can use already with PHP4 tree.

      If you have a big feature - ask for it, but currently there is nothing that is groundbreaking enough to even start working toward version 5.

      --

      Jobs? Which jobs?
  4. PHP Website by TheFlyingGoat · · Score: 5, Informative

    I've said it before, and I'll say it again... the PHP website should be enough for anyone with basic programming skills. It's simple, clearly explained, and there's many examples and fixes posted by people. The only thing that would be helpful would be a PHP Cookbook that's as good as the Perl one.

    --
    You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
    1. Re:PHP Website by smack_attack · · Score: 5, Informative

      Ask and ye shall receive

    2. Re:PHP Website by Tablizer · · Score: 1, Insightful

      (* the PHP website should be enough for anyone with basic programming skills. *)

      Yes, but not everyone can afford DSL or cable lines to have instant access. And, books are often easier on the eyes than screens IMO.

    3. Re:PHP Website by smack_attack · · Score: 2

      The major benefit of the php.net manual is the comments. I've gotten a lot of "extra" info from them that weren't aparent through the given examples. I've also contributed my own notes (and still get emails from time to time thanking me for an obscure problem with php/apache/slackware).

      As for requiring DSL, you must be joking... the pages are text, they load, you read... it's not like the manual is in streaming video format or anything. Jeez!

    4. Re:PHP Website by nahdude812 · · Score: 3, Insightful

      Then they should download the downloadable documentation.

      Having never previously used PHP, the documentation here was actually more useful to me than the previous Wrox book, "Professional PHP Programming." But it's best as a reference, if you haven't done dynamic web programming before, you'd do quite well to invest in a wrox book, as I find them to be well geared at bringing you up to speed on a subject, and then serving as a good reference book.

    5. Re:PHP Website by stevey · · Score: 1

      Possibly stupid question, but does PHP come with documentation as part of the distribution?

      If it's all there for the download it would be nice if it were. I love the perldoc program, and it's accompanying POD documentation which comes with perl

      (I've only ever toyed with PHP, making minor edits to existing code, so I'd benefit from good documentation if I were to do some real coding in it)

    6. Re:PHP Website by Anonymous Coward · · Score: 0

      The O'Reilly PHP Cookbook just came out: http://www.amazon.com/exec/obidos/ASIN/1565926811

    7. Re:PHP Website by nahdude812 · · Score: 2

      yes it does. Check it out, there are a wide variety of options on how to receive your documentation. You can search it on their website, complete with user comments (which are frequently very helpful), you can download a Windows CHM help file (I think that's the extension) to search against it locally, you can download PDF, and HTML versions, and in a lot of different languages.

      Pretty much any help format you might want is available.

    8. Re:PHP Website by bwalling · · Score: 2

      Sure, you can get some things from there. It is not perfect by any means, though. I have the PHP4 Professional book, and I found it useful to get going. I don't open it anymore - I just go to the PHP site. However, I never could get myself started from the website alone (mostly a motivation thing, I guess).

      Some people prefer the style of books more than just the "definition" style of help files.

    9. Re:PHP Website by stevey · · Score: 1

      Sorry I guess I wasn't being clear enough - I meant to ask "By default when you download PHP do you get documentation?".

      Your reply suggests that you do not.

      Having the documentation online with user feedback/comments is great - and being able to download docs seperately is also good enough for most people I guess.

    10. Re:PHP Website by nahdude812 · · Score: 1

      No, I suppose you're right, there's no option to download source and documentation as one archive. Instead you have to do them individually, which is how I'd prefer it, when I'm doing a minor version upgrade, I don't need a new copy of the documentation to prolong the download, and if I do want a new copy of the documentation, then I can have it on the download queue before the previous download has completed even with a very fat pipe.

      Out of curiosity, your final sentence implies that although this method is good enough for most people, that it's not good enough for you, what would you consider good enough?

    11. Re:PHP Website by nkg · · Score: 1

      Even better than the website..

      A local copy.
      see http://www.php.net/mirroring.php for more info. Even function shortcuts work.
      i.e. on my machine http://www.php.dev/gzcomress would take me to the right page: http://www.php.dev/manual/en/function.gzcompress.p hp very handy if you know the function you want to use but need to check the user notes on.

      My local mirror is approx 25-30 meg.
      So it's a big, but worth it download even over dialup.. Once a week a cron job sync's me with new entries.
      perfect

    12. Re:PHP Website by Tablizer · · Score: 1

      As for requiring DSL, you must be joking... the pages are text, they load, you read... it's not like the manual is in streaming video format or anything. Jeez!

      What about the dial time everytime you need to look for something? Stay on the phone forever?

    13. Re:PHP Website by smack_attack · · Score: 2

      http://www.php.net/download-docs.php

      Download the extended chm version, it has user notes included.

  5. Re:Using PHP on a professional site by onion2k · · Score: 4, Interesting

    Yahoo recently started using PHP to run their site. PHP is not just another toy language to tinker with, its a very capable tool. Don't confuse 'easy to use' with 'not powerful'.

    When you make a complete enterprise site, you use the language that will give you the most advantage for maintainability and design.

    Exactly. PHP often fulfills that need.

  6. Re:Using PHP on a professional site by Gambit-x7x · · Score: 3, Informative

    yea that why Yahoo is moving to PHP and not Java hmmm and here is slashdot articke about Yahoo moving to PHP

    i have worked with both and i PERSONALY prefer PHP, I haven't faced a problem in php that I couldn't have solved....

    --
    Who controls the information, controls the world...
  7. This book is great by mr_z_beeblebrox · · Score: 4, Interesting

    PHP is a great solution for small to mid size businesses. Designing server based database apps is easy and they can run on Linux/MySql (duh!) which is a great kick in the TCO for a small/mid size biz. While I agree with the earlier flame regarding PHP in the enterprise I do think it works pretty well for business apps just not with thousands of users.

    One thing I feel is missing is the ability to USE the host system. If I could access serial devices for example I could have a pc as a database server and one as a cash register, then I could have a serial based cash drawer at the PC being controlled by the server (this is a fairly common POS setup) this would be very useful. (I know I can use Perl to do it)

    1. Re:This book is great by LostCluster · · Score: 3, Interesting

      PHP is intended for run-in-the-browser apps, and really does not have much in the way of support for anything that doesn't. In exchange for direct functions to send HTTP headers and cookies, you basically give up the ability to "control" the host computer.

      PHP is not a be-all language, and it'd turn ugly quickly if they tried to force it to be one.

    2. Re:This book is great by StandardDeviant · · Score: 3, Informative

      You could write the serial control mechanism in perl (or C, or whatever), then use system() (or related) calls from php to poke it / read the output. Not elegant perhaps, but... The other option, since reading and writing to serial ports isn't exactly rocket science or a new thing, would be to grab some C source to do said, and wrap it into a PHP extension (which seems like a semi-easy process from what little I looked at it, if it were truly difficult there wouldn't be bazillions of php extensions). Honestly though, if you start doing hardware access to vital resources from php PLEASE FOR THE LOVE OF GOD make the server machine accessible only on the local lan. In other words, you might want JoeBob the store manager in the back office to be able to have a real-time web interface to moniter the sales line, but you wouldn't want to expose that interface to Dieter the 13 year old German 1337 h4X0r. ;-)

    3. Re:This book is great by mr_z_beeblebrox · · Score: 3, Informative

      In exchange for direct functions to send HTTP headers and cookies, you basically give up the ability to "control" the host computer.

      PHP is not a be-all language, and it'd turn ugly quickly if they tried to force it to be one.


      Bear in mind I am meaning access to functions on the server, not on the PC. You may well understand that but these days it can be iffy as to what people mean by host. PHP has a lot of good control functions and a lot of POS apps are run in the browser, hence my example. I feel PHP is rather well suited for that. A lot of people say it is a "perl replacement" to them I offer that if Perl can not do what you need, maybe a new programmer will help more than a new language :-)

    4. Re:This book is great by mr_z_beeblebrox · · Score: 2

      Honestly though, if you start doing hardware access to vital resources from php PLEASE FOR THE LOVE OF GOD make the server machine accessible only on the local lan. In other words, you might want JoeBob the store manager in the back office to be able to have a real-time web interface to moniter the sales line, but you wouldn't want to expose that interface to Dieter the 13 year old German 1337 h4X0r. ;-)

      Great info (regarding the serial mechanisms) and totally agreed regarding the above. POS apps are rarely on internet capable machines (at least so far)

    5. Re:This book is great by 8282now · · Score: 1

      As someone who pretty much used the first edition cover-to-cover, I can honestly say it was a decent introduction book but it definitely lacked the details that would've made it really useful.

      Regarding the issue of using the host system:
      What about using the system through exec or accessing the system through system shell resources?

    6. Re:This book is great by ice+cream+koan · · Score: 2, Insightful

      PHP is not a be-all language, and it'd turn ugly quickly if they tried to force it to be one.

      I don't think the PHP developers have any real intention to try and force it to be. However, besides using PHP for scripting web site db-driven apps, i've also found PHP (compiled as a cgi app) to be useful for writing scripts to be run by cron that need to easily tie in to the same database that runs the web site. I probably wouldn't try to write GTK apps in PHP, but building scripts that are not web-driven (but that interact with a web-driven system) in PHP (instead of say perl) has been handy, they can tie into your existing libraries and code.

      I can't really weigh in on the whole Java vs. Perl vs. PHP vs Python vs ASP vs ... debate, because I haven't done enough development in most of those languages, but I don't understand people who dismiss PHP off hand as being "only for rinky-dink personal websites".

      PHP isn't perfect, but it is fast, stable, feature-rich, and easy to develop web apps in. It certainly has its place in the toolbox, IMNSHO. The biggest thing lacking right now is good OO support. Right now it's clunky and sloooow. Zend 2.0 (when it's ready) should make great strides forward.

      --


      "When I was in school, I cheated on my metaphysics exam: I looked into the soul of the boy sitting next to me"
    7. Re:This book is great by nahdude812 · · Score: 3, Informative

      With permissions set in /dev, you can't access and control system devices such as serial ports? Are you running PHP in safe mode? If so, you'll probably have to disable that.

      I've had only a little experience using PHP to talk directly to devices, but it's been successful experience. I should think you'd be able to pop open the cash drawer and stuff like that on the server with PHP using filesystem functions on /dev entries. Unless of course you're using PHP on Windows, then I'm sorry, but you bear the burden of a lower OSform.

    8. Re:This book is great by seann · · Score: 1

      Ok
      Your gonna have to flame me in the reply, but why can't you access serial devices?
      This is something I created a few years ago when I realized "Why can't I just access /dev/stdin"
      Same thing goes for "/dev/ttSy*" or /dev/
      There really is no reason why you can't access serial devices.
      Infact, an even better solution:

      --
      I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
    9. Re:This book is great by seann · · Score: 1

      sorry..slashdot messed up ..Better solution is:
      Here.. For real this time.
      Try replacing fsockopen with fopen, etc.
      Have fun with your new found abilities

      --
      I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
    10. Re:This book is great by Tony-A · · Score: 2

      Assuming mod_php as an apache module.
      Mod_php runs as apache (possibly under the name nobody) and can do anything to the server that apache can.
      Default installation will allow apache to read and write whatever is world readable/writeable, but that can easily be changed to whatever you need.
      Backquotes work very well in PHP (essentially the same as in shell scripts).
      While apache and php *will* run under Microsoft Windows, there are several things that work right on *nix and don't work right on Microsoft Windows.
      PHP and Perl are both very good general-purpose languages. Nothing will really succeed as a "be-all" language.

    11. Re:This book is great by mr_z_beeblebrox · · Score: 2

      Your gonna have to flame me in the reply, but why can't you access serial devices? This is [phpbuilder.net] something I created a few years ago when I realized "Why can't I just access /dev/stdin"

      I don't have to flame you. When you post something (that could be helpful) in a community of people in some of the highest paid professions around you might grease the wheels a bit better. You never know if you might be posting the solution to a problem which has been vexing the owner of a multi million dollar company, and that's a nice ice breaker trust me. Don't worry that didn't happen this time. I have yet to break a million :-) but thanks none the less. As for why can't I, I focus on programming business logic if the language doesn't do something for me then I let someone else fix it or switch languages. My pay comes from solving problems regarding where an item goes, not how the computer accesses it.

    12. Re:This book is great by nahdude812 · · Score: 5, Informative

      I can weigh in on that a little, having first learned and worked with ASP for 2 years before I got in to PHP, and having now been active in ASP and PHP both for that past two years.

      ASP vs PHP there is so completely no comparison. There is only one single thing that ASP does that is easier than in PHP, and that is application-scoped variables with out a database. I've written my own PHP classes to facilitate this, and although they may not be as efficient as ASP's memory resident access, they are just as useful.

      The hugely wide variety of functions PHP provides make programming a delight where you work more on your programming concepts and code flow than on authoring code. There are simply hundreds of functions available in PHP that I use on almost every page, that would require custom-written functions (that thus run as script, at lower performance than the precompiled PHP functions) that are simply not available in ASP. Try to do a join() or split() in ASP. Yes, it's doable, but with quite a lot of legwork. How about regular expressions? Searching, replacing, replacing with code execution, and more? Not gonna happen in ASP, nope.

      Then there are SIMPLE things that are HTTP standards that are simply lacking in ASP. For example, uploading a file. Gotta buy a plugin in ASP to do that. Or uploading creating an array of elements on a form. If you want to have an unknown number of entries in a form, in PHP, you can name the input fields, "field[0]","field[1]","field[2]" and they come in as an array. Or you can even name them "field[]","field[]","field[]", and they will come in as an automatically indexed array. Useful when you want to do things like add rows of input to a table with javascript, and have a script that easily handles the collection. Try to upload an array in ASP, and you have to write code that breaks down the field names to your liking.

      There are so many functions that I take for granted in PHP that I now have my own library of PHP functions rewritten in ASP so that when I am authoring in ASP, I'm not as limited by the language. Just try to do an md5 in ASP, or any other cryptographic operation though, I dare you.

      Ok, sorry, rant over, been working on an ASP for the past month solid, and I think I'm going through PHP withdrawl.

    13. Re:This book is great by mackstann · · Score: 2

      POS apps are rarely on internet capable machines Internet Explorer? ;-)

    14. Re:This book is great by Green+Light · · Score: 1

      HA HA HA HA...

      Of course, we know that he meant Point-Of-Sale apps, not POS ones line IE 8^)

      --
      "Send an Instant Karma to me" - Yes
    15. Re:This book is great by IEFBR14 · · Score: 1

      I guess I'm spoiled by ASP.Net:

      A quick search on MD5 in the help yielded this:

      Function getMD5hash(data() As Byte) As Byte()
      ' This is one implementation of the abstract class MD5.
      Dim md5 As New System.Security.Cryptography.MD5.MD5CryptoServiceP rovider()

      Dim result As Byte() = md5.ComputeHash(data)

      Return result
      End Function

      There are also objects for regular expressions which are available for use. I agree, though that the older .asp stuff was a pain.

    16. Re:This book is great by mackstann · · Score: 2

      ok i just realized i totally fucked it up by forgetting to switch to plain ol' text and creating a run on sentence. >=|

    17. Re:This book is great by Anonymous Coward · · Score: 0

      I jumped from ASP to PHP because it offered more functionality. Now Im busy jumping from PHP to ASP.NET. I really suggest you look at it.

    18. Re:This book is great by Anonymous Coward · · Score: 0

      One thing I feel is missing is the ability to USE the host system.

      What do you mean by that? You can do an fopen("/dev/ttyS0", "w+") and use the serial port all you want. I've been doing that for years to read data from barcode readers.

    19. Re:This book is great by seann · · Score: 1

      people in #PHP on dal.net always flamed me for using php for serial access :>

      --
      I'm a big retard who forgot to log out of Slashdot on Mike's computer! LOOK AT ME.
    20. Re:This book is great by Anonymous Coward · · Score: 0

      Having similar experience, I have to totally agree. I work on a day to day basis with ASP and have just as much experience with PHP. As you state, I have found many things that can be done very quickly and easily with PHP vs. ASP.

      I also have experience running PHP in a very high volume site, and it actually FAR outperformed a similar ASP site that we frequently had problems with due to the volume.

      I'm sure that had to do with many variables, such as IIS vs Apache, PHP vs ASP, MySQL vs DB2, etc. They all came in to play, but in the end the Linux system with PHP blew away the IIS system with ASP (on the exact same hardware).

    21. Re:This book is great by Anonymous Coward · · Score: 0

      Sounds like you haven't use ASP in like 4 years or maybe never.

      VBS and JScript have all of the following:
      + join() and split()
      + RegExps (although in vbs they suck)
      + runtime code generation (eval())

      Furthermore, form fields with the same name have always come in as an indexed collection.

      ASP is a pretty limited environment, and PHP *slightly* less so, but there's no need for high-ranked inaccurate FUD. Java and .NET blow them both out of the water.

    22. Re:This book is great by Anonymous Coward · · Score: 0

      You said it yourself. RegExps really suck in VBS. That alone can drive you to PHP if you really need them!

      PHP's string functions in general blow away what ASP and VBS have to offer.

      I can't comment on ASP.NET or the .NET Framework because I don't have experience with it yet. I'm looking forward to testing it out soon though.

    23. Re:This book is great by Anonymous Coward · · Score: 0

      Well, VBS sucks in general -- and PHP is basically BASIC -- the language is full of stupid inconstiancies like Set/Let and Function/Sub.

      But JavaScript is a decent language for small server-side stuff, has decent regexps, and is actually much faster than VBS for string handling in ASP.

    24. Re:This book is great by jeremyds · · Score: 1

      Sigh... Try to do a join() or split() in ASP. Yes, it's doable, but with quite a lot of legwork. How is this a lot of legwork? MyArray = Split(MyString, ",") MyString = Join(MyArray) How about regular expressions? Set regEx = New RegExp regEx.Pattern = patrn Set Matches = regEx.Execute(strng) Searching, replacing, replacing with code execution, and more? Not gonna happen in ASP, nope Result = InStr(MyString, "asp") Result = Replace(MyString, "/.", "slashdot") having first learned and worked with ASP for 2 years before I got in to PHP, and having now been active in ASP and PHP both for that past two years For someone who's had four years of experience in ASP, you sure have a lot to learn.

    25. Re:This book is great by nahdude812 · · Score: 2

      I should state that this is ASP as it pertains to VBScript, not Javascript, in ASP 3.0. Split() and Join() don't exist in ASP 3.0. In fact, inherrently, associative arrays don't exist, you actually have to create Scripting.Dictionary objects, which afford a lot of the same control ultimately, but with more legwork.

      Also, my original quote was,
      How about regular expressions? Searching, replacing, replacing with code execution?

      You answered with instr() and replace(). The equivalents of PHP's strpos and str_replace.

      I meant, how about PHP's preg_replace, preg_grep, preg_match, preg_match_all, preg_quote, preg_replace_callback, preg_split, just to look at the perl compatible functions, let alone all the ereg_* (POSIX compatible) functions.

      With the preg_replace function, your replacement can actually be executable code that is executed run-time.

      For example,
      echo preg_replace("'&#([[:digit:]]+);'e","chr(\\1)",$in put);
      will output the original string with every digit escaping re-translated to the character code that it would represent. Again, yes, you can do this with your examples, instr(), and replace(), but it won't be one line of code.

      The above example is an example of a search and replace with code execution. It locates every &#[any_number_of_digits]; and executes PHP code to decide how it should be output.

      Also, PHP is just easier to code in. I can't tell you how annoying it is to have to do this:
      response.write "Coordinates: x:" & xCoord & " y:" & yCoord & " z:" & zCoord & "
      " & vbcrlf
      when in PHP I can write
      echo "Coordinates: x:$xCoord y:$yCoord z:$zCoord
      \n";

      Want to author a PDF from an ASP page? Good luck. How about authoring a SWF from an ASP page, or a GIF or JPEG? I count 93 functions for image authoring/editing/manipulation. Access to POP3/IMAP? LDAP? SNMP? Non-Application-scoped semaphores? Non-Application-scoped shared memory? For goodness sake, receive an uploaded file with out a 3rd party purchased plugin??? How about retrieving a file from another website, or opening a socket? Write a custom class? Spellcheck?

      The list goes on and on and on. I'm sure ASP.Net has breached this gap in leaps and bounds. I can't answer to that, as most places are still out-of-the-box setups and don't have that option, so I haven't gotten to play with it. The previous version of ASP though, has a long ways to go to play catchup.

    26. Re:This book is great by jeremyds · · Score: 1

      Split() and Join() do exist in ASP 3.0 and I use them all the time. These functions are a part of both VBScript and JScript and are therefore a part of ASP 3.0. Am I missing something?

      I must have misinterpreted what you meant when you said "Searching, replacing, ...". However, you can do regular expressions with ASP 3.0. If you read my original post again:

      Set regEx = New RegExp
      regEx.Pattern = patrn
      Set Matches = regEx.Execute(strng)

      More information on this is available on this at the MSDN site

      I'm not disagreeing that PHP generally offers more functionality than ASP and can be easier to code at times. I'm just trying to keep the comparisons accurate and fair.

      ASP.NET does blow both PHP and ASP (and JSP for that matter) out of the water, though. You should look into it if you get the chance.

    27. Re:This book is great by King+of+the+World · · Score: 1

      ASP.NET theoretically blows both out of the water. It's a good idea - high level concept tags replaced with HTML tags at runtime - but in Microsoft practice they fuck over non Microsoft browsers.

    28. Re:This book is great by Anonymous Coward · · Score: 0

      Actually you can acces serial ports through php, thanks to its FOPEN function, or it's other socket functions. Check this php.net manual entry for info. (do a search for "SERIAL PORT" on the page, its somewhere near the middle of the user comments).

  8. Re:Using PHP on a professional site by Synn · · Score: 5, Interesting

    I've been using php for about 5 years professionally and have actually been looking into using Java, mostly because I'm interested in the concepts behind MVC design.

    But one of the things php has given me over the last 5 years is total rock solid stability. I mean, I've hacked up some complete crap code over the years but I've never once had a php related crash(and apache only ever crashed when we tried integrating Cold Fusion into it).

    In testing Java servlets I have gotten out of memory errors in a database app I've written, but that could very well have been a lack of knowledge on my part(maybe I had the server misconfigged). I'm reading up more on admining/designing for Java now and will do more serious tests in the future.

    But don't dismiss php as a toy language. The code you create can be messy, but it's rock solid stable. 5 years of 80k+ lines of code without any crashes is nothing to laugh at.

  9. whats new? by WrongWay · · Score: 2, Interesting

    So whats new in this edition?? Whats diff between the professional PHP 4 book I bought like 2+ years ago , and this book?? or is this just an insanely late book review???

  10. Re:Using PHP on a professional site by FortKnox · · Score: 3, Interesting

    Actually, I thought they migrated using PHP for background scripting, not on actual pages that are displayed (I think they still use a proprietary C system).
    Of course, this is all out of my memory, not actual links.

    Funny thing is, I wasn't gonna start the "J2EE vs PHP for professional site" flamewar, and then someone else goes and starts it.

    And PHP doesn't have the greatest OO built in that most architects drool over.

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
  11. Slashdot will move to php soon by Anonymous Coward · · Score: 0
    1. Re:Slashdot will move to php soon by smack_attack · · Score: 2

      *nuke blows, code bloat and feature creep gone horribly awry. You can't even rip them apart and fix it to your site's needs without hours of headaches and eventually deciding to roll your own.

    2. Re:Slashdot will move to php soon by Anonymous Coward · · Score: 0

      ...and eventually deciding to roll your own.

      At least let someone else make the rolling paper.

      http://phpwebsite.appstate.edu/

    3. Re:Slashdot will move to php soon by OzRoy · · Score: 1

      But PHPNuke is not the best tool for the job. Yes PHP kicks arse (with some exceptions though) but Nuke is a piece of crap coding wise.

      I must admit I haven't looked at it in a long time, but what I saw convinced me that it won't get any better without a complete rewrite. The guy who wrote it seems to have no real understanding of how to use OO which is fairly obvious in his implimentation of the database abstraction layer, and practically EVERYTHING is all lumped together making it almost impossible to change the system to what you want. Nuke modules are basically shit because of that.

      As for PHP, it's an awesome language, and I think almost all of my problems with it are being fixed in 4.3. Better OOP and exceptions YAY!! I'm looking forward to it.

  12. In Scope References! by TimeReliesOnLadyLuck · · Score: 0, Flamebait

    I learned php a few months ago, but I think I'll stick to perl. If you're making some simple web pages that just need to be marked up, I guess php is okay, but why bother adding a php module to Apache when you've got mod-perl?

    In Perl, the language helps you, but php just seems to get in the way. Without the equivalent of Perl's excellent DBI/DBD, I don't see much use for php.

    1. Re:In Scope References! by TheFlyingGoat · · Score: 3, Informative

      Without the equivalent of Perl's excellent DBI/DBD

      Like ADODB?

      --
      You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
    2. Re:In Scope References! by Nos. · · Score: 2
      Now please correct me if I'm wrong here (I'd rather learn something), but the reason I really like PHP is the fact that I can turn it off and on in an html document, something you can't do with PERL (unless I'm wrong here).

      I started playing with PHP and MySQL sometime ago, just to see what it was all about, and all I can say is wow. I've learned so much, and started doing some small contracts with PHP. Its so nice to be able to take a .html doc from a web developer, cut the dummy data out and add in a couple of PHP lines, and bang, the page is now live to the database!

    3. Re:In Scope References! by Malcontent · · Score: 2

      DBI/DBD is a library written on top of PERL just as ADO, ODBC, JDBC etc are libraries written on top of other languages.

      PHP has many such libraries to choose from. Here is a short list (you can google for the exact locations)

      ADODB, Metabase, PEAR, PHPLib.

      Please do some research before you post lest you look like an ignorant fool.

      --

      War is necrophilia.

    4. Re:In Scope References! by Anonymous Coward · · Score: 0

      There are, in fact, several "in line" Perl+HTML solutions using mod_perl. Most notably, Mason (www.masonhq.org) and Apache::ASP (www.apache-asp.org).

    5. Re:In Scope References! by ctembreull · · Score: 2, Insightful

      I agree. That's why we did a rough port of DBI to PHP for my workplace PHP environment. It's amazing what you can do when you actually sit down and write code, instead of bitching about something not being able to do x.

      --

      Chris Tembreull
      "My karma just ran over your dogma."
    6. Re:In Scope References! by Anonymous Coward · · Score: 0

      When I began learning about CGI I was using perl.. But it always pissed me off how long it would take to execute the scripts. Since learning PHP I've kept away from using Perl for CGI purposes.

      I'm not sure what I was doing wrong, but PHP seems to be 100x faster than any perl scripts. Then again, I wasn't using mod_perl, just sticking executables in the cgi-bin directory.

      Could anybody else give some more information about the differences in speed between perl and php?

    7. Re:In Scope References! by TimeReliesOnLadyLuck · · Score: 1

      Okay, thanks, I couldn't find anything equivalent when I first started using php.

      So can you tell me how to use both on apache? I imagine I can get a some kind of cluster of apaches with some mod-perl and some php? That would be useful. I guess I can no longer say that all your php sites aren't as good as what perl has.

      Okay, You Have Won. Now don't gloat about it.

    8. Re:In Scope References! by Anonymous Coward · · Score: 0

      I don't know about php, but mod-perl run MUCH faster than just putting perl scripts in the cgi-bin directory, which means that every time someone requests the page, perl is loaded into memory again.

    9. Re:In Scope References! by tom.allender · · Score: 1
    10. Re:In Scope References! by MmmmAqua · · Score: 3, Funny

      This was a decent attempt at a troll, but I feel you could have gone much further with this. You see, the hallmark of a truly great troll is the ability to push something to such an extreme that it greatly offends everybody, even people who agree with you. With that simple principle in mind, allow me to re-format your original post so that it fits snugly into the mold of a great troll.
      Ahem...

      I learned php a few months ago, but I think I'll stick to perl. If you're making some simple web pages that just need to be marked up, I guess php is okay, but why bother adding a php module to Apache when you've got mod-perl?

      Should read:
      I learned PHP a few months ago, but I think I'll stick to machine code on the bare hardware. If you're making simple web pages, why bother letting an enormous pile of cruft (like all of Linux) get in your way when you've got all the power and simplicity of machine code available? Besides, who really trusts a big, creaking mass of code put together by a bunch of Communists in Finland?

      In Perl, the language helps you, but php just seems to get in the way. Without the equivalent of Perl's excellent DBI/DBD, I don't see much use for php.

      You missed a golden opportunity here. Here's an easy fix:
      In machine code, the machine helps you by locking up and smoking when you make a typo, but PHP just seems to get in the way by spitting out a bunch of cryptic error messages. Why pollute an already clean error-reporting mechanism (the machine locking up and setting my desk on fire), with a bunch of crud like "Error: Syntax error in line 16", when high-level messages like that only abstract away the true source of the error? Frankly, without the equivalent of machine code's clear and easy-to-understand near and far pointers (on x86, of course, but who really uses that RISC crap, right?), I don't see much use for PHP.

      So now, armed with a more complete understanding of the True Way of the Troll, the next time you make a boob of yourself in front of all of Slashdot, you'll do it in a thoughtful, thorough manner.

      --
      Arr! The laws of physics be a harsh mistress!
    11. Re:In Scope References! by justaddfire · · Score: 1

      Or PEAR::DB even.

  13. Not Deep Enough by ze_lee · · Score: 5, Informative

    I was going to pick up this book, based on the recommondation of friends (programmers) and online reviews, but when I thumbed through it in the bookstore, it just seemed...weak. Thin.

    This is PROFESSIONAL PHP programming, not BEGINNING PHP. Why even have the 100 or so odd pages on installation? This book is not targetted at newbies, it is for the serious developer. OK -- you're a J2EE dude who want to check it out; doesn't have PHP installed. Lots of references on the Web, and if you can't find them...you're not a Web developer.

    While the book probably would be helpful as a reference in some cases, I was just disappointed in it. The cookie/session section was a joke (and this is new in v4, so should be fairly rigorous).

    I didn't buy the book. And I like having references around. I have 7-8 open on my desk right now, from Perl through DHTML to PHP. Oh well, as people have noted, v5 is coming, so I guess we shouldn't get our packets in a bunch...

    1. Re:Not Deep Enough by vladkrupin · · Score: 1

      This is PROFESSIONAL PHP programming, not BEGINNING PHP. Why even have the 100 or so odd pages on installation? This book is not targetted at newbies, it is for the serious developer.

      Because they went to great lengths to cover every single caveat. Note that there is really nothing in the book that you can't find online. On the contrary, google, will probably be more informative than the book.

      Books are for those who are more comfortable with this kind of media (or have painfully slow internet access). And it will fit a few developers' needs. Aside from that, any sufficiently complicated issue is really hard to cover in a book, so online you go... I mean, you have a problem X, and trying to solve it results in behaviour Y. How can you possibly find an answer to that very specific question in a medium that can not be searched for Y, or a part of it? Alphabetical indexes are of some value, but still suck compared to a real search.

      --

      Jobs? Which jobs?
  14. I agree to a certain extent by Twister002 · · Score: 3, Interesting

    It depends on what exactly the enterprise size app is doing and what it needs to connect to.

    For example, an enterprise wide phone extension list could easily be done using PHP instead of Java.

    A complex work-flow application might not be the best fit for PHP. A whiteboard collaboration tool definatly would not either, PHP-GTK not withstanding. :)

    I've used PHP to call both Java and VB COM objects on the same page. I had to work with two different groups in a company, one used Java, the other used VB. It was easier to use PHP than to write a wrapper for either.

    --
    "For a successful technology, honesty must take precedence over public relations for nature cannot be fooled." -Feynman
    1. Re:I agree to a certain extent by Anonymous Coward · · Score: 0

      (* Posting how you have successfully created Visual Basic COM objects is embarrassing *)

      That is *not* what the poster said. They used PHP to integrate into existing COM stuff from the VB team. He is bragging about the integration, not COM building. RTFP.

  15. Re:Using PHP on a professional site by FortKnox · · Score: 3, Informative

    Thanks for the link. Now I can say, with confidence (from the article):
    Yahoo has decided to switch from a proprietary system written in C/C++ to PHP for their backend scripting

    Backend scripting != PHP pages on yahoo. This article wasn't read very well by slashdotters. They aren't converting yahoo over to PHP, they are using it for scripting.

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
  16. Up to date one year later? by dcuny · · Score: 3, Interesting
    Almost an year since its release, this book has stood the test of time, and proved to be what it promised -- an up-to-date, advanced book on PHP -- a category in which there are very few worthwhile entries to date.

    So the book is still up to date, even an entire year after it's release?

    Something's wrong here... Those php people better get on the ball and start releasing more often! The only language I know of that's stays that stable is COBOL.

    No point in playing with it, unless it's the latest bleeding edge, crashing and burning on a regular basis. On my Windows box, that is - my BSD box remains rock steady.

    Nope, still not funny.

    1. Re:Up to date one year later? by Anonymous Coward · · Score: 0

      Releasing what? It works. They add features as needed (which isn't often now). They release bug fixes as needed. What more do you want?

    2. Re:Up to date one year later? by Anonymous Coward · · Score: 0

      Check out the code a Wrox' website - it's clean updated for the latest version of PHP.

  17. Spoken like... by Ron+Harwood · · Score: 2

    ...a true troll who has never used the language. Or at the very least hasn't used it enough to see the true power and simplicity it provides when used correctly.

  18. I bought this 2 years ago by Anonymous Coward · · Score: 0

    I can't say how this book is for a professional programmer, but it's good for a newcomer to PHP. It is clear in examples although some of the items don't work perfectly.

    It does cover what is claimed but as I recall it has some items that it explicitly states need work in terms of security. The biggest complaint that I had (it may be fixed now) was that the companion website at wrox did not work. There were some cookbook sections I wanted to test (where I suspect I did not type in something in caps) and I wanted to copy and plug. However it did not work.

    cheers

  19. Re:Using PHP on a professional site by Gimpin · · Score: 2, Insightful

    And why do you think Java/J2EE is the best choice for an "enterprise" solution? The best choice has nothing to do with the language...it has everything to do with how the compiler/interpreter is implemented and what your developers are comfortable with...oh, and a word on portability, it is a pipedream for any application that is built for an "enterprise".

    --
    "Simon Says, Fuck You" - George Carlin
  20. Merits of PHP compared to Perl? by SteweyGriffin · · Score: 1, Offtopic

    I have to prepare a report at my job discussing the merits of Perl and PHP and would like some ideas for good points to put across in favor or against either one.

    Personally I favor Perl as I think it can do much more but I'm not an expert by any means and I'd like to present some reasonable sounding arguments, possibly in front of people who are experts in Perl.

    Any ideas?

    Oh, and another question. I'm not 100% sure how Perl actually runs the Perl code. I know it gets compiled to P code, but I'm not sure at what stage this is done. Can anyone tell me how this works or give me a pointer to where I could find it?

    As usual, thanks for your help Slashdotters.

    1. Re:Merits of PHP compared to Perl? by Lordrashmi · · Score: 2

      What are you going to be using the language for? That is a key deciding factor.

    2. Re:Merits of PHP compared to Perl? by dcuny · · Score: 3, Funny
      Given that:
      1. You already have a bias toward Perl, and
      2. You're talking to Perl experts, which means
      3. They're probably geeks and Slashdotters
      something along these lines should work:
      • "All right thinking coders will agree that Perl is the only language fit for the job."
      • "4 out of 5 ACs on Slashdot agree with me."
      • "Tolkien would approve of Perl. No wait, that was your other post.
      • "Does anyone want to spend another boring week in training?"

      OK, I didn't really have anything useful to write. I just like making HTML lists.

    3. Re:Merits of PHP compared to Perl? by Anonymous Coward · · Score: 0


      Perl Merits: mod_perl, DBI and Free speech.

      PHP Metits: easy for poeple with a C/C++, Vbasic windows background.

    4. Re:Merits of PHP compared to Perl? by SerialHistorian · · Score: 1

      We have this argument at work all the time. ;)

      The big deciding factor is what you'll use it for. If you just want to display dynamic web pages, PHP will be easier and faster in most cases than Perl ever will.

      If you need to do a ton of weird crap, Perl is probably your best bet. Same thing if you have to do a ton of character translations and regexp-ing.

      The big difference between Perl and PHP is that Perl is easy to learn in its simplicty, but can get incredibly weird as you get into the expert levels... to the point where a beginning coder can't figure out what the fsck Mr. Joe Camel, Perl Wizard, was smoking when he wrote that bit of code. OTOH, it can do a lot more.

      PHP is pretty much limited to basic browser web interfaces. It's amazingly easy to learn and program, and a lot of things that are moderately difficult to do with Perl are easy in PHP. PHP code that does complex and weird things is also fairly easy to read and understand. OTOH, it is very limited, but it's very good at what it's limited to.

      PHP is a great tool for web development. Perl is commonly referred to as a "Swiss Army Chainsaw", because it can do just about anything you want it to do, but it's almost always overkill.

      That being said, you should explore HTML Mason just a little bit if you like Perl but want the equivalent of PHP in Perl.

      --

      --
      Vote for your hopes, not for your fears - Vote Third Party

    5. Re:Merits of PHP compared to Perl? by alkini · · Score: 2, Informative
      I switched from Perl to PHP early in my Web development days for a few reasons. Perl has an entire culture that comes along with it that advocates perl as the solution to everything, and that kind of thinking made made perl a pain to learn, especially for somebody that just wanted to write dynamic Web content, not rule the world with his regex talent. I was also annoyed by always printing out content headers and the CGI modules were clunky and had too much overhead.

      With that said, I feel that the top reasons to use PHP rather than perl are:

      • PHP's embedded nature as opposed to perl's stand-alone nature (I realize that perl can be embedded, but it's rarely used that way). This makes it easier to get simple code in to a page (just embed the code rather than creating an external file with proper permissions, header code, etc in the right location.
      • Simplicity of the language -- PHP is much easier to read and learn. This is so important when you develop a project with multiple coders involved or when a project needs to be taken over or maintained by somebody other than the intial developer(s).
      • Avoiding modules. PHP includes nearly all of the basics that you need for dynamic Web development and the extra code that you may need can just be tossed in to your code directories rather than installed as a module. This is nice when you have to deal with ISPs or server admins that are slow to install software and it makes it easier to move your code from one server to another.

      I realize that most of this won't convert a perl advocate (what would?) especially if they're going to be the sole coder on a project, but that's rarely the case with real production systems.

      Related links: Google: php vs perl, Web Automation: PHP vs. Perl vs. PHP

    6. Re:Merits of PHP compared to Perl? by Anonymous Coward · · Score: 0

      Uhh... mod_php?

    7. Re:Merits of PHP compared to Perl? by AtATaddict · · Score: 1

      Actually, I believe that Perl is parsed into a tree form, and then interpreted. Perl6 will be compiled to Parrot bytecode, which will then be executed by the Parrot virtual machine.

      As for embedded scripting languages for web usage, if you're coming from a Perl background, eRuby and mod_ruby might be a better fit.

      From everything I've heard, mod_ruby runs more efficiently than mod_perl or mod_php. Additionally it will give you smooth handling of regular expressions - something you may be taking for granted with Perl. It wraps the Ruby language, so you can use the same code in plain old scripts, without any extra markup. Definitely worth a look.

      The only cns may be fewer libraries available, but last I checked there were good interfaces for all of the buzzwords(databases, XML, SOAP, etc.)

    8. Re:Merits of PHP compared to Perl? by eddy+the+lip · · Score: 2

      I've done a fair bit of development in both PHP and Perl (mostly web development, which is what I assume you're referring to). I'm not a PHP expert by any means, and I've been doing Perl for much longer, so take that into consideration.

      Perl is more succinct. Depending on your point of view, this is a good or a bad thing. You do need to acquire a higher proficiency with the language than is necessary with PHP in order to really make this useful, and to make sure that less experienced programmers on your team aren't confused. Things like use English; can help, but if someone really feels like shoving an evaluated regex into a map call, you can't stop them. (I feel like this often). I find that I often resent how much more typing I have to do in PHP.

      Perl is more mature. PHP is coming along rapidly, but things like recent major changes with super-globals and default config options (register_globals) do make it feel a little unfinished and slightly unplanned. They're just growing pains, but you still have to deal with them.

      This is also reflected in the documentation. PHP has pretty good documentation. Perl's is excellent. It's had a few more years to polish it.

      Debugging is much, much easier in Perl. The perl command line debugger is a great tool, and I wish PHP had something like it.

      If you don't have control over where it's going to live, PHP is easier to deploy. This is the single reason I use PHP almost exclusively for web development these days, and I hope this is addressed in Perl6. With PHP I can simply specify PHP version x and MySQL are required. If PHP is on the server, it's almost guaranteed that MySQL is and that's it's all hooked up nice. With Perl, if you need something that requires a C extension (eg, DBI), the host may or may not have it, depending on how much the admins like installing extra stuff. If you have appropriate access you can install it yourself, but if you don't, you're out of luck. Whether or not this is an issue for you depends on where your planning to deploy.

      CPAN. CPAN is marvelous. There is an immense amount of useful Perl code in there. If you want to do something, there's a good bet someone else has wanted to, too, and contributed it. The PHP community is working hard at building something like it, but CPAN has years on it.

      Regarding perl compilation - I was going to take a stab at it, but it's been too long since I've had to read up on it, and I'd bullocks up the details. If you have a copy of the camel (version 3) handy, there's a good section on it in there. Sorry, don't have a link handy.

      HTH

      --

      This is the voice of World Control. I bring you Peace.

    9. Re:Merits of PHP compared to Perl? by CoughDropAddict · · Score: 2

      I agree with most of your post, but "Perl's documentation is excellent?" It works well as a reference for someone already familiar with Perl, but as an explanation of the language it's hideous. It's written as manpages, with names like "perlsyn," "perldata," and "perlre."

      The Camel Book, on the other hand, is great.

      But for electronic documentation, PHP has perl beat by a mile. It is organized, comprehensive, and user-annotated.

    10. Re:Merits of PHP compared to Perl? by eddy+the+lip · · Score: 2

      heh. Point taken. This is probably one of those places where my being more familiar with perl colors my opinion. It can be hard for someone new to it to find what their looking for in the pod. I still think that, once you've figured out where things are, it's generally more polished than the PHP docs. I often find those cryptic, and sometimes downright unhelpful. And the user-annotation on the PHP docs _can_ be great, but it can also be downright inaccurate. Not that I don't think it's a great idea, and I check it frequently myself. You just have to be careful with it. POD's got a long ways to go itself - it could learn a lot from, for example, the JavaDoc format. But I've always found the content very to the point and "expert friendly."

      Which is maybe one of the big differences - the perl docs aren't really meant for learning, they're for reference. When I'm in a hurry, they're just what I want. As always, YMMV.

      --

      This is the voice of World Control. I bring you Peace.

    11. Re:Merits of PHP compared to Perl? by arthurs_sidekick · · Score: 1

      Read up on what you're talking about. mod_perl embeds a Perl interpreter into Apache. You can specify that a given Perl routine handle any of the phases of an Apache request, not just the content generating phase, which is the only place PHP can do anything. Basically, mod_perl gives you a running Perl instance in the background, not just during the individual request.

      --
      "Oh, I hope he doesn't give us halyatchkies," said Heinrich.
    12. Re:Merits of PHP compared to Perl? by ozzy_cow · · Score: 3, Informative
      when you pick php you have to be careful what you buy into... unlike perl, php is controlled by a vendor. php by itself is free, but if you want to do anything serious w/ it you will need zend optimizer which is about $2g per cpu (im talking 300% performance increase through caching etc). hey, mod_perl is free and it does basicly the same thing.

      performance wise, i think perl and php are on the same level

      i started out with php and then slowly moved to perl. i still have a lot of apps in php that i have to manintain once in a while ... and let me tell you - its major pain.


      php is really easy to learn and implement, but it lacks infracstructure. on the other hand, in perl you get away with a lot more things and its true that if you are not careful perl will get obfuscated and unmaintainable very fast.



      beauty of perl comes in when you put effort into developing strong infrastructure and stick to it. always use strict, -wt (warnings and taint mode). organize your code into neat modules (CGI::Application) and use a templating system (HTML::Template is very simple and wont let you clutter html with code). note that php doesnt have any of this features as readily available as in perl through CPAN modules


      when it comes to documentation, it might be true that php has good resources online, but perl has a lot larger comunity (check out perlmonks.org) i got replies on my questions within 30 minutes of posting!


      in short... perl has superior architecture to php, however php has better corporate support and better learning curve

  21. Re:Using PHP on a professional site by Anonymous Coward · · Score: 0

    wow, did you mommy not give you the xbox you wanted for christmas?
    what he was refering to is when I log into my yahoo email, Im not going to php pages, Im going to yahoo's c++ system pages. what they use php for isn't heavy bandwidth dependant, nor heavy user dependant like most professional sites. now, did I bring it down to your level, or should I use my kindergarden voice?
    why don't you go shovel snow for extra cash so you can buy that xbox you want, instead of fuming over slashdot like an aimless loser.

  22. Re:My god by Anonymous Coward · · Score: 0

    IN SOVIET RUSSIA, silliness monty python proportions...uh...you? Maybe not.

  23. Get over yourself by papasui · · Score: 3, Informative

    Everyone that flames PHP needs to go sit in the corner and remember not to break their magic bubble of personal space. First the slashdot article is about the book not the language, second use whatever works for your needs. If PHP works for you and like it thats wonderful. If not use something else, there's a lot of other options.

  24. Re:Using PHP on a professional site by boinger · · Score: 2

    PHP stands for "PHP: Hypertext Preproccessor". Not "Personal Home Page". It hasn't meant that for years.

    --
    Send your friends messages of love at fuck-you.org
  25. Re:Using PHP on a professional site by rmayes100 · · Score: 2, Informative

    I think it depends on what you need your site to do. If all you need is to run database queries and output the results (basically what /. does) then languages like PHP, Cold Fusion, Perl work fine. PHP and Cold Fusion make these kinds of tasks very easy to do and they scale just fine for these types of applications. Where I always run into problems is with applications that require much more...connecting to sockets on other servers to retrieve data and then parse data (XML etc), connecting to booking systems, middleware or mainframe systems, manipulating images on the server that kind of stuff. It seems most enterprise applications end up going beyond what languages like PHP and Cold Fusion can provide without having to write custom tags in C/C++ or Java or something to make up for the shortcomings of these languages. At that point you might as well write the application in J2EE or something that is a little more robust than what most of the web scripting type languages can provide.

  26. Re:Using PHP on a professional site by Malcontent · · Score: 2

    I see php in lots of very busy sites.

    Just today I noticed that Insight is using php. I am pretty sure they were not using that before and migrated to php from something else.

    --

    War is necrophilia.

  27. Who needs a book? by unorthod0x · · Score: 2, Informative

    I've been using PHP quite heavily for a few years now; I never picked up a PHP book, not once.. Why? Simply because the community support, the IRC channel, the Online Documentation and even places like devshed simply have so much to offer! I have not even once printed or purchased even a mere shred of dead tree painted over with ink that describes or outlines PHP in any way whatsoever.

    1. Re:Who needs a book? by Anonymous Coward · · Score: 0

      So what? Your comment adds absolutely nothing to this thread. Do all us flunkies a favor - walk on water this weekend.

    2. Re:Who needs a book? by orim · · Score: 1

      So are you telling me you're carrying your laptop to the bathroom at work?

      --
      "If you could only see what I've seen with your eyes..." - Roy Batty
    3. Re:Who needs a book? by Anonymous Coward · · Score: 0

      PHP news groups are a great source for some quick, real-time help, too. I also use the php.net site devoutly. It's a lot easier than thumbing through a book,especially since you can do searches. I have the PHP4 book as well, bought over 2 years ago. And a couple of other smaller PHP books. But they are more for beginners, but still good. I'm no anonymous coward. I am a member here and can't remember my darn password. My username is aeontrek. My site is: http://www.aeontrek.com

  28. So extend PHP by Ron+Harwood · · Score: 4, Informative

    You can write your own extension (in C for instance) to interface with the hardware - and provide the PHP functions you want.

    See here for details...

  29. Re:Using PHP on a professional site by Anonymous Coward · · Score: 1, Insightful

    He said maintainability and design.
    PHP vs Java when it comes to design isn't a contest. Java has much better built in OO than PHP.
    Maintainability depends on how it is written, regardless of language.

    I'd argue that the things to have for an enterprise site is how well you can design the language, how fast the pages run (including DB hits, etc), and how quickly it can be written.

    Using the "what your developers are comfortable with" is what developers tell their bosses when they don't want to learn a new language. What if all your developers are comfortable with assembly?

  30. IN SOVIET RUSSIA... by Anonymous Coward · · Score: 0

    the silliness of monty python takes on YOUR proportions!

  31. Php is great! by viper21 · · Score: 2

    Now if only I could actually find a job where I could use it.

    Anybody? :-)

    -S

    1. Re:Php is great! by outsider007 · · Score: 2

      Yahoo made the switch to php recently. You might need a degree to apply though.

      --
      If you mod me down the terrorists will have won
    2. Re:Php is great! by technix4beos · · Score: 1

      Bored, got time on your hands? I'm looking for programmers willing to spend time coding some modules.

      I started the phpMyJobs project on sourceforge and am about to release a small bundle to get people going.

      If you're interested, please contact me via that page.

      --
      user@host$ diff /dev/urandom /dev/uspto
    3. Re:Php is great! by davidmcn · · Score: 1

      If you worked with me you would be using it. The project I'm on right now is entirely in PHP and MySQL :)

      --
      Memories become legend, Legend fades to myth, and even myth is forgotten by the time that age comes again.-Robert Jordan
  32. web forms are *not* simple by Tablizer · · Score: 4, Insightful

    (* Designing server based database apps is easy *)

    If you mean data input and query screens, I have to take some exceptions to that. Simple stuff is indeed simple in web apps. However, B-to-B and intranet managers often want GUI-like behavior from browser-based apps, and HTML+JS+DOM can turn into a tangled mess under such demands.

    The developer cannot just say, "well, this is an HTML browser, not a GUI, so it will not have all the functionality of a GUI", because that would be a half-lie. With enough effort and spahgetti code, you *can* make it do GUI-like stuff, but the code is usually horrible. The current standards are optimized for e-brochures, and NOT e-biz-forms.

    What is needed IMO is HTTP-friendly GUI browsers, using protocols like XWT and SCGUI (I'm still looking into Mozilla). (I rule out non-HTTP protocols because fire-walls often don't accept them. Some protest this, but I don't want to rekindle that debate here.)

    There is a huuuuuge need for such in my observation, and no vendor is stepping up to the plate. PHP could still serve as the server-side part of such a system, BTW.

    1. Re:web forms are *not* simple by mr_z_beeblebrox · · Score: 1

      Wow, your plug was very subtle. I see from your site that this issue may have crossed your mind before.

    2. Re:web forms are *not* simple by stretch_jc · · Score: 1

      Have you checked out FlashMX Remoteing? It allows you to write thin client applications in Flash, and connect them to a remote ColdFusionMX server. Oh yah, and it communicates via HTTP

    3. Re:web forms are *not* simple by Tablizer · · Score: 1

      Wow, your plug was very subtle. I see from your site that this issue may have crossed your mind before.

      Yeah, usually I put "(plug)" or something right after it, but I forgot this time. Sorry. I don't sell ($) anything related to it, BTW.

    4. Re:web forms are *not* simple by Tablizer · · Score: 1

      Have you checked out FlashMX Remoteing? It allows you to write thin client applications in Flash, and connect them to a remote ColdFusionMX server.

      Does it work with server languages other than ColdFusion?

    5. Re:web forms are *not* simple by phong3d · · Score: 1

      Yep. It has connectors for .NET applications and Java server apps as well. There are other projects out there to integrate it with PHP. It also natively parses WSDL.

  33. Re:Using PHP on a professional site by Malcontent · · Score: 3, Funny

    "And PHP doesn't have the greatest OO built in that most architects drool over."

    Actually it has "pretty good" OO. In some ways it has "pretty advanced" OO like mix-ins. PHP5 will have "even more advanced" OO.

    Anybody who uses J2EE for a "less then enterprise" web site is just asking for pain. Better to stick needles in your eyes it would hurt less.

    If you really want to use java go with webobjects.

    --

    War is necrophilia.

  34. So is it a good newbie book? by nlinecomputers · · Score: 1

    So you think it isn't a good Professional book. Is it a good newbie book? Even if it is poorly named? I not a programer but would like to learn and have been learning PHP on my own. Would this be a good investment or waste of cash?

    --
    Slashdot, home of supporters of free software, free music, and free speech.Except for Moderators that disagree with you.
    1. Re:So is it a good newbie book? by quiklilo71 · · Score: 1

      Damn straight that poster was an AC (anonymous coward)!
      PHP is a GREAT web developer language and is growing in popularity thanks to module based applications like php/postnuke.

      Learn PHP, it's fun, realitively easy and a great place to get into writing code.

  35. Book, benchmarks and other things... by mgkimsal2 · · Score: 2

    One - the book is OK, but out of date if only because of the 'register globals' stuff - they shouldn't have assumed it was on in a 'professional' book in the first place, imo.

    Second - shameless plug - we offer PHP training classes. here

    Third - PHP topics always devolve into 'java/perl/.net/asp/cf is better than PHP'. Anyone who is interested in putting together serious multi-platform tests between PHP and other languages, please contact me privately, as I'd like to arrange something with other developers. Not as 'one language beats all' but to present some tests which aren't sponsored by the companies (MS, Sun, whoever) which obviously have a BIG bias as to how they want the results to appear. Having a cross section of multiple developers from multiple platforms agreeing to common test terms would help eliminate that, I think.

    1. Re:Book, benchmarks and other things... by ergo98 · · Score: 1

      Having a cross section of multiple developers from multiple platforms agreeing to common test terms would help eliminate that, I think.

      I agree that something like this would be beneficial. Sort of on a tangent, I'd love to see a serious showdown between Postgresql and the heavyweights including feature lists, performance on a common platform, scalability, etc. I've found that Postgresql seems to get advocated a lot (as a natural step-up for MySQL fanatics when they realize that their MySQL advocacy is a little hollow) yet there are virtually no metrics or empirical evidence to back any superiority claims (versus Oracle, or SQL Server, or Interbase, etc).

      Having said that, it is extremely difficult to make something unbiased. Bias can come into play in things as simple as "which features to list on the feature comparison list" (for instance, again segueing to Postgresql, a business associate recently pointed out a "failing" in SQL Server in that it didn't let you do XYZ, yet there is no credible reason that anyone would ever want to do XYZ in a real world situation. That sort of line item is common in feature lists).

    2. Re:Book, benchmarks and other things... by sheldon · · Score: 2

      "Anyone who is interested in putting together serious multi-platform tests between PHP and other languages, please contact me privately, as I'd like to arrange something with other developers."

      That sounds interesting, and I would like to help. I tried contacting you via the contactus page on your website.

      If that doesn't work, it's easier to figure out my email address as it's anything @ sodablue.org. :)

  36. Please listen up to my noteworthy advice by SteweyGriffin · · Score: 3, Interesting

    We recently switched from perl to PHP. Perl seems to be much better and handling file manipulations and it definitely is more a more complete language. But developing in PHP is so fast that the switch was easy.

    With PHP, the default "thing" in a file is html that it just spits out. You have to do something special to make PHP code to run. So if I configured my server to handle .html with cgi-bin/php, all of my pages would still be served fine (although slower if run as a CGI.) What this means is that our layout people can design pages and we can easily put in code after the page design is done to make it look just like they want it. If they then want to move stuff around, they can (for the most part). They can even use editors like frontpage (and it won't complain about the php code if you use the code delimiters.)

    Also, with PHP you can also do things like this:
    <? if (somthing) {?
    Something was selected
    ? } else { ?
    Something was not selected
    ? } ?>


    so when I am printing out large chunks of html based on some variable, I can just use html without messy prints all over the place. Of course, you can use perl "print EOP" type statments, but I think the PHP approach is more elegant.

    Also, the fact that PHP takes care of all the variable collection was a big plus for me. I just type testing.phtml?id=2&name="jeff" and sure enough, $id=2 and $name=jeff. Obviously, you can do the same thing in perl and it's not terribly difficult. But in PHP it is just that much easier and it's one more thing I don't have to worry about.

    I would strongly recommend that you at least try PHP for a simple mail form or something. I think you'll fall in love with it for web stuff. And if you're doing database work too, then I think you'll really like it.

    1. Re:Please listen up to my noteworthy advice by mgkimsal2 · · Score: 5, Informative

      The 'id=foo&name=bar' translating to $id and $name defined is per the 'register globals' setting, which is now off by default in new installations. You'd need to identify where things are coming from:

      $_GET['id'];

      More typing, but generally safer, as it does force you to think about where things are coming from.

    2. Re:Please listen up to my noteworthy advice by Matts · · Score: 4, Informative

      Ah, hopefully grasshopper you will learn in time that embedding code inside your HTML is a really bad idea. Sadly PHP (and JSP and ASP and a whole host of other languages) encourages this behaviour.

      What you really want is a good templating system.

      (Yes, I know PHP can do templating systems, thank you).

      --

      Matt. Want XML + Apache + Stylesheets? Get AxKit.
    3. Re:Please listen up to my noteworthy advice by Anonymous Coward · · Score: 0

      OK. Now you are posting two trolls per story? In one of your trolls you are asking for advice about switching and in this one you claim to already have switched. When are moderators going to wake up and realize that SteweyGriffin is a troll manipulating the slashdot moderation system.

    4. Re:Please listen up to my noteworthy advice by duplicate-nickname · · Score: 0, Flamebait

      You may want to check out ASP.NET then. ;)

      --

      ÕÕ

    5. Re:Please listen up to my noteworthy advice by GigsVT · · Score: 1

      For the lazy/migrating people:

      extract($_GET, EXTR_SKIP);

      This will assign all the GET vars to local vars, unless the local var is already defined, in which case it will skip over it. A little safer than register_globals on, but not as safe as explicitely assigning only the variables you are expecting to come from GET or POST.

      BTW: You can do the same command with POST instead.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    6. Re:Please listen up to my noteworthy advice by bahwi · · Score: 1

      You can also use $_REQUEST['id'] which gets it's data from $_GET, $_POST, and $_COOKIE, but be careful, it can be insecure like register globals too.

    7. Re:Please listen up to my noteworthy advice by bahwi · · Score: 1

      Yeah, but you have to brew your own generally. Smarty is too much for me. But in response to what the poster said, you can embed HTML inside of your PHP code. Sometimes a thorough templating system can be hellish, and pointless. Wasting CPU cycles to re-format every time even though it comes out looking the same each time. But you are right, and I completely agree with you. It's best to keep code out of HTML.

    8. Re:Please listen up to my noteworthy advice by Ducky · · Score: 1

      Haven't seen mention of this yet... HTML::Mason is one of a few embedded Perl solutions that operates very similar to PHP/ASP/JSP, etc.

      To take your above example, rewritten in HTML::Mason would look like this:

      % if ( something ) {
      Something was selected
      % } else {
      Something was not selected
      % }

      HTML::Mason also takes care of the variable collection. All arguments are put into %ARGS, in addition to putting them into declared variables:

      <%args>
      $id => 0
      $name
      </%args>
      $id would be assigned 0 if the GET/POST didn't supply it, whereas $name would throw an error if it wasn't supplied.

      Also, general printing of variables is easy, too:

      Hello, <% $name %>!

      In general, a very decent system that addresses what you thought Perl couldn't do. Of course, this is just the tip of the iceberg for Mason. I won't even go into its inheritance model, it's default handlers, autohandlers, component model... that's worthy of an entire O'Reilly Book. =)

      </perl-plug focus="HTML::Mason">
      In the end, use the tool you're more comfortable with. If you like canned scripts (mail submit forms, BBSes, etc), PHP has a ton of them. If you want to code more of it yourself, Perl's CPAN is extensive. JSP for... uh, something, I'm sure. And if you're masochistic, there's ASP. ;P

      -Ducky

    9. Re:Please listen up to my noteworthy advice by Anonymous Coward · · Score: 0
      <? if (somthing) {?
      Something was selected
      ? } else { ?
      Something was not selected
      ? } ?>

      In general, I've found this to be cleaner:

      <? if (blah): ?>
      some html
      <? else: ?>
      some other html
      <? endif; ?>

      Yes, this is PHP. You can even do this with "foreach():". Looks cleaner, makes it clear there's no code in there, just html. Also might be easier on your editor since you probably don't want to indent the html that goes inside those.

      Another great thing new phpers often overlook:

      Instead of:

      You have <? echo $entries; ?> entries.

      use this:

      You have <?= $entries ?> entries.

      Makes a big difference in legibility on complex forms. Also really helps with separating logic from presentation, which becomes really important with larger php projects (php is great for large projects, but it takes some planning ahead of time to separate presentation and logic).

      The php OO stuff is not very sophisticated, but it's simple. You can make it do things it wasn't designed to do like pure virtual classes and dynamic typing (eg, changing the type of a object at run time from class A to class B) - you can do these things because you can sit down for an hour and understand how the php OO stuff works internally, with no surprises. It also has serialization built-in, which is very nice - you can make your "session" an object, stick it into a database, and have the user come back later and all their state is right there. You can also use it for more complex things like caching complex computations or sql queries with one line of code. I really hope they don't mess up the OO stuff and make it internally complex in php5.

      PHP also has sane APIs for writing C extensions - it's much easier to write a PHP extension than it is to write a perl XS extension (perl XS extensions don't even look like C).

      Now only if javascript/dhtml/css2 worked as they were supposed to work, application programming would be ridiculously easy.

    10. Re:Please listen up to my noteworthy advice by Anarchos · · Score: 2

      That's not any safer than enabling register_globals, because register_globals will extract $_GET at the beginning, before any local variables have been created. The skipping functionality is only necessary if you try to extract $_GET manually (i.e. after you have created local variables).

      --

      "A good conspiracy is an unprovable one." -Conspiracy Theory
    11. Re:Please listen up to my noteworthy advice by GigsVT · · Score: 1

      Well, it's a little safer, because you can selectively extract only GET POST SESSION, or whatnot.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    12. Re:Please listen up to my noteworthy advice by Anarchos · · Score: 2

      Ah true, I see your point.

      --

      "A good conspiracy is an unprovable one." -Conspiracy Theory
  37. Perl Vs. PHP battle brewing here? by Tablizer · · Score: 1

    In Perl, the language helps you, but php just seems to get in the way.

    Languages are subjective. I don't personally like Perl because it makes it too easy for other developers to write cryptic code (at least cryptic to me). Larry Wall focused too much on reducing keystrokes and not enough on readibility. I don't want to start a flame-war, for Perl fans are probably fast at reading Perl code. It just ain't for me.

    Also, it encourages people to roll-your-own-half-ess-DB, which I think is a mistake because the data is then less sharable with other langs and apps and does not scale without overhauling the code. IOW, collection manipulation interfaces are not "wrapped" such that you can switch from nested arrays to a database without calling code rework.

  38. Review or Dust Jacket? by Anonymous Coward · · Score: 1

    This wasn't a review. It didn't go into any detail about the chapters or the nature of the examples and prose. Essentially, this was nothing more than someone paraphrasing the material in the forward, back page, and TOC. Completely useless.

  39. Re:Using PHP on a professional site by Anonymous Coward · · Score: 0

    Nahh, bro, I'll just to to your mom and ask her to buy it for me.

    Seems like after your dad discovered the Internet, he's been spending too much time morphing scanned images of you onto his favorite kiddie porn pics, and masturbates to it once in the morning before work, and once when he gets back home.

    That leaves no semen for your mom, which is where I come in, no pun intended. She'll usually give me around $50 a load every couple of days, but this being Christmas, I'm gonna ask her for $200 so I can buy my X-box.

    Did you know she goes through your undies to look for extra cum stains to lick, just in case you had an accident? It's sad, she should go work at a sperm bank, I say.

  40. non-HTTP gui business apps by smartfart · · Score: 2
    Post or moderate? Hmm....

    I like PHP and web apps, and code a little here and there... but I must say that if you are designing a business app, security is of the utmost importance. Therefore, it seems to me that you can design a regular app (QT/$backend, or some other combination) to run on the server, and have the clients log in via ssh or something similar and have the app run on their desktops via port forwarding/X forwarding. This seems to me to be way more secure than SSL web applications, and eliminates the deficiencies you just mentioned.

    Ok, there are problems with this scenario (what if the user's connection drops occasionally?), and these would be hurdles to overcome, but my point is that while web apps are 1337, there are other more traditional and perhaps easier ways of making an app with the kind of gui that's needed for business apps

    1. Re:non-HTTP gui business apps by Tablizer · · Score: 2, Insightful

      I have seen and heard about tons of problems, often political, of getting firewalls to work. One place had about 100 customers. The went HTTP because there were to many complaints about diddling with fire-walls.

      It is more "accommodating" to change your system to use HTTP than to ask 100 customers to play with their firewalls (and hire real firewall experts).

    2. Re:non-HTTP gui business apps by zby · · Score: 1

      The problem with X forwarding would be bandwith. HTTP can be used in most circumstances - it is designed for low bandwidth of remote internet conections while the X protocol is designed for the bandwidth of LAN's.

    3. Re:non-HTTP gui business apps by lactose99 · · Score: 2

      Shhh...

      Its talk like this that puts security admins (like me) out of a job. ;->

      --
      Fully licensed blockchain psychiatrist
  41. TROLL TROLL TROLL by Anonymous Coward · · Score: 0

    This is a fake post. Please note that Stewey is a troll who steals from other discussion groups. He has never had an original idea in his head. Please do not mod up.

  42. Re:Using PHP on a professional site by Anonymous Coward · · Score: 0
    Using PHP instead of something like Java/J2EE for an enterprise size site is not the best choice.

    FUD-OFF

    Are these the same enterprise sites that ALWAYS seem to require javascript? <sarcasm>Are we to believe that J2EE is not up to the task of parsing user input</sarcasm>. Surely the developers realise that only morons allow third parties to run arbitrary scripts on their systems.. then again!

    I've never used zend optimiser on PHP, I'd sure like to see some benchmarks comparing it with java. Of course there is no contest when it comes to actually maintaining the code - this is the reason I switched to PHP in the first place.

  43. Re:Using PHP on a professional site by rycamor · · Score: 2

    MVC is just an object-oriented design concept. There's no reason you can't do it with PHP. And, if you want a "middle tier" for PHP (persistent objects/connections, brokering, etc...), check out http://www.vl-srm.net/

  44. PHP .chm Help Files by SerialHistorian · · Score: 1

    The PHP website offers several relatively small windows help files that you can download and keep on your hard drive... if you want, it'll even display user comments. That way, you don't have to always be connected to the web while you're coding.

    --

    --
    Vote for your hopes, not for your fears - Vote Third Party

    1. Re:PHP .chm Help Files by Anonymous Coward · · Score: 0

      I think we slashdotted php.net. It seems down.

  45. Smarty? by n-baxley · · Score: 2

    Has anyone worked with the Smarty templating extension? It seems like it would lead to better MVC use, but I haven't had time to use it yet. Will I be wasting my time?

    1. Re:Smarty? by dynamiteweb · · Score: 1

      I decided to go with a similar class that I found at HotScripts.com

      http://www.hotscripts.com/Detailed/11031.html

      Just like the name implies, it is very fast. It will really help you speed up development time if you end up re-working your HTML or JavaScript layout/code. Well worth the time to seperate PHP and HTML, especially if you have more than one person on the project or could in the future. Have fun!

    2. Re:Smarty? by Anonymous Coward · · Score: 2, Informative
      Smarty is excellent. Combined with DB::DataObjects from the PEAR suite (see pear.php.net) and you have a very powerful platform for rapid development.

      A rough outline of the way it works goes like this, you make your SQL schema and load it into your database, then you point DB::DataObjects at the database and it generates class wrapper files for each table. This by itself isn't fantastically useful, if you were just writing PHP the difference between using the class and using the DB PEAR stuff directly is pretty minimal, however its when you bring smarty into the picture that things get interesting.

      The reason is primarily because you can then pass the object you've retrieved from the database straight to smarty without thinking about it, within your template you can acccess the properties (Although not the results of methods, much to my dissapointment) directly, so *your* code doesn't need to worry about it, which means any time you want to add a new field to a table, you just add it in the database, run the dataobjects create script and then plonk it in the template, and it Just Works.

      The DataObjects create script is pretty smart, the class definitions that it generates are marked up with comments that give you flexibility to customise the class without risking the modifications getting overwritten next time you regen.

      Leaving you with only the "glue" PHP in the middle to write, the bit that handles logins, decides what functions need to be called to do what, and what page to display at the end of it. Believe it or not, smarty comes to the rescue here as well, giving you a simple mechanism to split up your logic and display operations.

      One of the primary problems with a PHP script is the switch statement. In the begining, people didn't give a rats about decent user flow, so every page was a different PHP script, and this worked fine except in the case of error conditions or multi-operators, ie, ok, I've just added the user, but now I'm stuck in add_user.php and I want to send them back to list_users.php. Some particularly object oriented people managed to get around this by having everything in classes, but it really didn't work well.

      Then came the switch statement, in the switch statement, everything effectively was in index.php, sure we had a lot of includes, each of which did a fairly specific thing, but in the end, all requests went to one script, and specified a mode or op or sequence or whatever you want to call it. This variable determined what was to be shown (ie, op=add_user), then, when add_user was done it'd call the list_user op equivalent somehow.

      The issue here was that the switch statement rapidly became the debuggers worst nightmare. Without a decent templating frontend, PHP and HTML became mixed into case blocks, includes were all over the place, and the amount of state to track mentally in any given place was horrendous. Decent programmers utilised standard methods to reduce the clutter but it still never really felt clean, go check out a lot of the PHP scripts available on the web these days to see what I mean, its pretty common.

      Another, small subset decided to use url redirects and the multi-file approach to resolve the same issue, they had the same problems but just confined to particularly ugly URLs and lots of page reloads.

      Recent advances and ideas have left us with a lot more options. Those who are still heavily OO are still running fine, they're not developing that quickly, but their code is ok, some of the more abstract programmers are doing ok on a task-by-task basis, developing entirely new structures as appropriate to the problem, but again, development time is the cost, and often a lack of code reuse means a lot of debugging.

      The MVC model is of course entirely appropriate to the particular problem, and what I suggest here is basically that concept although not explicitly.

      The idea essentially, is that for any page displayed, there are a number of actual "atomic" operations that need to be done. For a login page perhaps there are none, its just a damn login page. For a user edit form, there is the retrieval of the users details (and possibly a permissions check), for the page that actually does the update of the users details, there are the permissions check, the update, possibly the display of the original edit form with details filled in an an error message, or possibly the display of a user list with a message indicating the edit was successful.

      Always, at the end, we display a page of some kind, and we never do anything after that.

      We also never display more than one page, we might decide between two but we don't show more than one.

      Thus I construct my PHP apps like this:

      1. Require in DataObjects, Smarty, misc
      2. Initialise connections etc
      3. Retrieve session details if possible, otherwise get Guest user
      4. Define functional units, functions whose task is to *do* something. If these functions have anything to output, they $tpl->assign it into the template store, if they run into an error condition, they call the relevant display unit with the error message
      5. Define display units, these act as wrappers for the $tpl->display() call, displaying a particular template with all the data gathered so far
      6. Define the sequence switch, this is a switch statement on a variable, each element of the case blocks is *only* function calls, to any number of functional units, and finishing off with a display unit. Nothing else, just that.
      The end result? you have a list of operations, a list of pages, and a nice clean set of instructions on how to put them together. It is possible to extend this to handling error conditions in the sequence switch however without exceptions (coming in php 5 w00t!) you're likely to find yourself wasting a lot of time trying to come up with an error passing routine, I haven't found a real downside to just calling the display functions directly in case of error.

      The biggest benefit of this method is pure speed, you can develop small bits of functionality quickly within the framework, you can string them together arbitrarily for various combo pages (assuming you've been careful with your template namespace) and late additions can almost always be handled gracefully with a minimum of effort.

      Phi.

    3. Re:Smarty? by elbobo · · Score: 2

      smarty has been shown to be faster than FastTemplate (can't find the benchmarks just at the moment. smarty.php.net isn't responding). Smarty's caching can also massively increase speed, especially with pages requiring hefty database work.

    4. Re:Smarty? by mobosplash · · Score: 1

      I've used Smarty and patTemplate and like them both. I don't know that I would really call it MVC but they keep layout out of the logic. With patTemplate especially I end up with a lot less files that are easier to edit.

      I mostly use Java, either Struts or Servlets depending on the app. I was pretty much hating going back to php for anything until I started using the template engines. Now I wouldn't do php without one.

  46. PHP Security papers by Anonymous Coward · · Score: 0
  47. why doesn't php come with a code cache support? by Kunta+Kinte · · Score: 3, Insightful


    I know there are accelerators out there, but most people not know about or use them. Plus I really can't see the harm in including a accelerator in the default engine. Does anyone know why it is not included? There are open source accelerators that can be distributed with PHP.

    Many scripting engines eg. Cold fusion, JSP, compile code only the very first time the code is executed since the module was started, then only check to see if the code was changed on disk before executing the already-in-memory code.

    --
    Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
    1. Re:why doesn't php come with a code cache support? by gid · · Score: 2, Informative

      Zend sells it's own accelerator, so it's in their intest NOT to include caching in php, or else zend's sales would drop.

    2. Re:why doesn't php come with a code cache support? by Anonymous Coward · · Score: 0

      but a couple of good ones are available free and compete fairly well agains Zend's Cache product

  48. Mod-perl by lsmarso · · Score: 1

    Can mod perl really offer the same advantages, e.g. in terms of low overhead, for serving a high volume of dynamically generated web pages?

    I've read that php has a significant lead in this regard, but don't know all the details.

  49. How Perl Works by Local+Loop · · Score: 2

    To answer your question about how/when perl is compiled, it depends on the situation:

    • Command line or simple CGI program - your perl program is compiled each time it is run. This operation is much quicker than you might expect, but it's a painful amount of overhead for sites with tons of hits
    • CGI with mod_perl, minivend, other Perl based app servers - The Perl code is compiled once, when the web- or app-server is started. Compiled chunks of code are cached for later use after their initial compile. This is not done by the language, but by the environment, which is usually written in Perl (but can be written in C).

    As near as I can tell, PHP pages are compiled each and every time they are served, along with all the included code.

    1. Re:How Perl Works by BitHive · · Score: 2

      I'm no expert either, but there is some amount of cacheing of the compiled PHP on the server end. There are also a few PHP accelerators that probably do the same thing.

  50. Re:Using PHP on a professional site by Anonymous Coward · · Score: 0

    i see that filtering through the crap of your message, that you understood what I said. this means I was write, and your original quote was wrong. thats all I was after.

    oh, and those retorts hurt me. badly.

  51. question by sootman · · Score: 2

    I'm too lazy to click any of the book links, and I'm sure many people here have the same question anyway, so I'll post: does the book show variables the old way (just ask for $whatever and it pulls the value out of the air from POST, GET, etc.) or the new (4.2+) way where you need to say $_GET['whatever'] or $_POST['whatever']?

    --
    Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
    1. Re:question by Anonymous Coward · · Score: 0

      The code available on the WROX site (code for all the examples in the book) for download are updated to work with register_globals = "off" by default in the php.ini

    2. Re:question by sootman · · Score: 2

      thanks!

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  52. More review... by I.+B.+Geek · · Score: 1
    I'm a perl guy and I looked at a number of books before buying Professional PHP. I wanted to get up to speed fast. My critique:

    Good: More helpful for quick-start than the web sites. Reasonably complete, with good examples. Good PostgreSql coverage (and MySQL, of course).

    Bad: Some of the more obsucre aspects seem to have been simply copied from the web (same language, same examples). This is not helpful, if the original web-text was inadequate or obsolete.

  53. Re:Using PHP on a professional site by nick-less · · Score: 3, Insightful

    Actually it has "pretty good" OO.

    If I' had modpoints right now, I'd mod this up as "funny" ..

    Any C++ or Java Developer will loose his hair (I he has any left) when reading things like this or this

    (the later has nothing to do with oop)

  54. Hmmm... by zsmooth · · Score: 0, Troll

    Isn't "Professional PHP4" an oxymoron?

  55. PHP is good but TAL is the next generation of SSI by Qbertino · · Score: 4, Informative

    One thing that stirkes about PHP is it's position in the market. It simply ownz all other SSI technologies out there. From ASP over JSP to Cold Fusion, PHP is one of the outstanding successes of OSS.
    Yet all these SSI technologies have in common that they still don't manage to really split Design from content. I was all in for PHP as my way of doing SSI stuff until I ran into TAL. It's the second (next to DTML) SSI Language that comes with Zope and has been reimplemented in Perl (PETAL). The essential difference to other SSI solutions like the #1 PHP is that all SSI-relevant tags only come as parameters to standard HTML tags and thus absolutly don't interfere with WYSIWYG HTML tools or other stuff that belongs to markup. You even can get good editors to switch of the non-html tal parameters to do your markup uninterfered. Once on the server content of tal-parametered markup (tal-speak: "mockup") get's replaced with the dynamic content. The point is: Either way you have documents that can be previewed in browsers, edited and formated without the source code for serverside dynamics being touched - or vice versa.
    A simple trick to establish true separation of content and code.

    --
    We suffer more in our imagination than in reality. - Seneca
  56. Is that review for... by Anonymous Coward · · Score: 0

    the 1st anniversary of the book's publication?

  57. Re:Using PHP on a professional site by King+of+the+World · · Score: 2
    I like PHP. I write in PHP. I release OSS forum software that uses MySQL/Postgres. I've been doing this for 4 years.

    I haven't OO'd my PHP because I know the implementation sucks. I'm patiently waiting for PHP 4.3 (or whatever it is), and then PHP 5.

  58. GTK port by jmertic · · Score: 1
    > Non-Web Programming (including GTK)

    Is there anyone with much experience doing PHP-GTK? On the outside it seems like a nice way to use PHP's DB interaction on the desktop, but it seems the development is slow on it and I haven't seen many people using it ( and have heard bad things about it, but from the same people who say bad things about PHP).

  59. Re:Using PHP on a professional site by eguanlao · · Score: 1

    Phrame is a PHP version of Struts.

  60. Get the 3rd edition! by Wee · · Score: 3
    The link above points to the 2nd edition, which was published about a year ago (almost excatly a year ago, actually). Go to Sams' website and get the 3rd edition. It's a bit more up to date.

    -B

    --

    Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.

  61. In Scope References... by Anonymous Coward · · Score: 0

    Trolls teach you!

  62. So, so true by egg+troll · · Score: 2
    I've been working with PostNuke on a site of mine and I'm having so much frustration in getting it to do what *I* want. I'm probably just going to roll my own, you said.


    However, I think thats true of any web content program no matter what language its programmed in. I've seen Scoop/Slashcode frustrate people as much as PHP-based programs.


    However, I think PHP works outstanding as an abstraction layer between SQL and the web for smaller sites.

    --

    C - A language that combines the speed of assembly with the ease of use of assembly.
  63. PHP resolves some shortcomings of Perl by egg+troll · · Score: 2
    PHP isn't perfect but it does manage to fix many of the shortcomings I've had with Perl. Here are a few of the things I've noticed about PHP.
    • The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work (whether or not OO is all that great is another discussion.)
    • Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later. I've heard that this will be fixed in upcoming versions of Perl though.
    • Speed. PHP is one of the fastest languages I've ever used. While it won't be replacing assembly or C, its definitely faster than Perl in most cases. File handling and regex come to mind immediately. I'm sure there are cases where Perl is equal to PHP, but I can't think of any at the moment.
    • Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl requires that much rewriting.
    • Graphics. PHP comes with a nice little graphics library. While I wouldn't use its to code the new Doom (VB would be a better choice!) its adequate for most web pages, and should be considered as a substitute for Flash for certain things. Perl lacks a graphics library of any kind.
    Again this is just my experience. I don't mean to offend any Perl coders because Perl is an excellent language. However, in certain cases it may behoove one to write the back end in PHP instead of Perl. Thank you, ET
    --

    C - A language that combines the speed of assembly with the ease of use of assembly.
    1. Re:PHP resolves some shortcomings of Perl by b17bmbr · · Score: 1
      Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl requires that much rewriting.
      what exactly are you doing in perl that requires so much rewrite. unless your doing some system level admin, where perl is built around unix, for web functionality, there should be no problems. the only problem that i have found on win32 perl is that iis sometimes doesn't handle user permissions and read/write access as it should. for instance, if not properly configured, a cgi script can read and write files out side its parent directory. i was working on my school's web site, and added one too many ../'s and well, major oops. shouldn't be allowed to do that. otherwise, all the perl ran exactly as written on iis or bsd/apache.
      --
      My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
    2. Re:PHP resolves some shortcomings of Perl by Anonymous Coward · · Score: 0

      I've had the same issues as the parent of your post. Trying to bring Perl into IIS is horrible. I suspect this is because Perl is designed for *nix based systems. Nothing wrong with that. But sometimes you *have* to use MS. When that happens Perl can be difficult. PHP however fits in seamlessly.

    3. Re:PHP resolves some shortcomings of Perl by ajs · · Score: 3, Informative

      I won't get into PHP-vs-Perl, as I think the two complement eachother nicely (if you realy know how to use mod_perl and PHP, you can do some amazing things with the Web which are not idealy suited to either one).

      However, you are incorrect on some points:

      Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later. I've heard that this will be fixed in upcoming versions of Perl though.

      Since version 4 (over 10 years ago) Perl has had access to Sybase and Oracle. Newer additions (from the past 5 years or so) include MySQL, PostgreSQL, CSV flat-file DBs, DB2, *DBM, and an ODBC interface layer for just about any database.

      The DBI module provides one uniform interface to all of these.

      Speed. PHP is one of the fastest languages I've ever used. While it won't be replacing assembly or C, its definitely faster than Perl in most cases.

      This depends wildly on what you're doing. PHP is pretty slow when it comes to handling deep, and complex data-structures, but quite fast when it comes to handling simple data like strings. Perl maintains a balance between these two, and an elegant interface to C and C++ for applications which need to speed up critical sections of code.

      Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl requires that much rewriting.

      My Perl programs run on Windows, MacOS/X, VMS, all UNIXen, and many other platforms. Dunno what you've had trouble with, but I suggest you may have had trouble with Perl because you were not familiar with it.

      Graphics. PHP comes with a nice little graphics library. While I wouldn't use its to code the new Doom (VB would be a better choice!) its adequate for most web pages, and should be considered as a substitute for Flash for certain things. Perl lacks a graphics library of any kind.

      This is so wildly untrue, it's amazing! Perl has some of the most comprehensive graphics handling possible. From OpenGL to the GD module to PDL, Perl can do anything from complex scientific simulation graphics to simple 2 and 3-D charts and graphs to line-drawing. PDL requires special note. It's a library for dealing with arbitrary binary data in a number of ways from performing vast arrays of numeric transformations (e.g. Fourier Transforms, and other matrix transformations) to rendering graphics to modifying image data. It's a god-send for the scientific community that previously had to deal with proprietary systems that were of dubious value given that they could not be modified.

      There's even a comprehensive interface to The Gimp, which I wrote an article on for The Perl Journal.

      The Perl resource that you probably are not aware of (based on your comments) is the Comprehensive Perl Archive Network (CPAN). There is a module list that gives you a nice index of everything that Perl can do that is not shipped with the binaries. Perl also provides a CPAN module that can be used to automatically download, compile and install anything from CPAN.

  64. PHP Cookbook by jpkunst · · Score: 1

    How about this?

  65. Enterprise Shmenterprise by Anonymous Coward · · Score: 0

    and a much more complete object-oriented programming environment will allow PHP to provide a powerful Web front end for enterprise-class .NET and J2EE-based applications.

    What exactly is "enterprise-class"? Lots of users? Lots of PHB's to get in your way because they read some buzzhype in an airline mag? What does it mean?

  66. Re:PHP is good but TAL is the next generation of S by Anonymous Coward · · Score: 0

    This "separate content from code" cliche is a bit overused. A clean separation is often impossible because there are always exeptions that mere classification tags cannot take care of very well. You need fine granularity and boolean rules that only code can provide. Plus, if it is an intranet app, then changing your "skin" every full moon is not a very high priority. Put the "content" into a database if you want it dynamic.

  67. Re:PHP is good but TAL is the next generation of S by elbobo · · Score: 2

    TAL looks interesting, but it does get tiring reading people say over and over things like this:

    "Yet all these SSI technologies have in common that they still don't manage to really split Design from content."

    Any web scripting language worth its salt has at least one templating system available for it. For PHP I prefer smarty.

  68. Re:Using PHP on a professional site by Malcontent · · Score: 3, Insightful

    The links you point out all refer to the fact that php does not act exactly like C++ or Java. Once you actually learn the way php works those particular things don't bother you anymore.

    Yes php does not work like C++ or java I don't think anybody is arguing the opposite. I suppose lisp, smalltalk, ocaml, python and perl also don't work like C++ or Java. That's life.

    On the other side neither C++ nor Java allow you add methods or attributes to objects at runtime and PHP does. Maybe that's a good thing, maybe not, but I like it and whenever I use a language like java It makes me loose my hair when I can't do it. You have to take each language as it comes.

    --

    War is necrophilia.

  69. Re:Using PHP on a professional site by joib · · Score: 2

    One of the main reasons yahoo went with php instead of java is that freebsd currently has lousy thread support, which is quite essential for java apps.

    Another thing is that they still use their proprietary backend code, they are not going to rewrite that in php (or java for that matter).

  70. And isn't PHP a templating system? by zby · · Score: 1

    Yeah I know - it has developed over time. But generally the issue of templating is not so far from an general programming language. You'll never have such a clean separation.

    1. Re:And isn't PHP a templating system? by zby · · Score: 1

      Just to express my own personal preferences of templating systems - I believe that the most lacking thing is ergonomics. I mean - when you read someting like you don't see that closing parenthesis at the first glance. So personally I prefere Template::Toolkit with [% END %] - I can spot it instantly.

  71. Cookbook by ze_lee · · Score: 1

    There is a PHP Developer's Cookbook -- by Sterling Hughes and with contributions by Andrei Zmievski (if that last does not ring a PHP bell, forget it...).

    Not a good book, in my estimation. I've never thought I was king god of coding or whatever, but this book (and others) left me thinking..."Yeah, I learned [that] but...I already knew [this][that] and [the other thing]. I've never used it.

    While people have posted saying to use the PHP manual (which rocks, don't get me wrong, especially for bugs), it's not a cookbook or a good guide for newbies (either to PHP or a particular function). This is where books shine: Show how this or that actually works in practice, not abstracted out to the API.

    That said, use what works for you. PHP examples/code abound on the Web -- leverage this resource if it works for you. If you want a book, get a good on. (But view ./ for info!)

  72. A Criticism Of PHP5's Namespaces (plz read! :) by mccormick · · Score: 2, Interesting
    Actual, the current work to implement a cross between multiple inheirtance and Java-style interfaces is in the form of delegates, but I'm not going to talk about that here.

    I lurk on the php-dev mailing list, and one thing that I'm worried about with respect to the direction PHP5 is taking is the support for namespaces. The latest preview alphas of PHP 4.3.0 with Zend Engine 2.0 (as opposed to ZE 1.0, which powers the latest stable version, PHP 4.2.3) has demonstrated some of the above features in action (but they are, of course, still in-development.) The current 'implementation' (and I'm using that word loosely) of namespaces/packaging is something called 'nested classes', and let me assure everyone of the following: Zend Engine 2.0's "nested class" feature do nothing for implementing useful namespacing! Nothing!. They don't even work for logical things you would think they would. With nested classes, only the parent class can extend any other, and the nested ones absolutely cannot! Example:
    class Parent { /* think of this as a 'namespace' level, which you'll see is still useless */
    class Nested extends OtherClass {
    // ..
    }
    }
    Even the latest from-CVS snapshots (cvs co php4-ze2) crock with a very specific error message: "Nested classes cannot inheirit." So how exactly do these help in namespacing? They don't.

    Even the following like seem like a logical ability for nested classes, but ZE2.0 just doesn't support it:

    class SqlDatabase {
    /* consider this to be some kind of generic database access class, extended once per RDBMS; see below */

    class Connection {
    /* handles connection management; implementation omitted (it's just an demonstration of something useful for nested classes that PHP doesn't support at the moment) */
    }

    class Error {
    /* imagine the new try..catch exception capabilities throwing this kind of exception, that is, Database::Error; ideally it would contain detailed error information and easy ways to programmatically understand what it means (if it is just a warning, a fatal error, connection error, etc.) */
    }

    class ResultSet {
    /* holds the results of queries */
    }

    /* ... and et cetera.. more as applicable */
    }

    /* let's consider a hypothetical RDBMS implementation -- just names for now */
    class MySqlDatabase extends SqlDatabase
    {
    class Connection { .. }
    class Error { .. }
    class ResultSet { .. }
    }
    So, hopefully the above looks like a start, and, of course, this would provide the necessary generic interface so that other RDBMS could be implemented according to the same mechanisms. However, the above doesn't even begin to work as expected in PHP with Zend Engine 2.0.. In the MySqlDatabase class, we might see a nested class like 'Connection' and think it would relate to the parents' subclass by the same name. So, using condensed symbolisms, like this:

    * P is parent
    * P defines 'n' as a nested class (P.n)
    * C is child of P (in PHP, 'class C extends P ..')
    * C defines 'n' as nested class (C.n)

    I would propose that it would make sense that 'C.n' implicity extended 'P.n'. That could be useful, for example, in the above database example: a single root class, SqlDatabase, could provide a variety of interfaces that are grouped together and not disjoint. So not just a bunch of related classes like MySqlError and MySqlConnection but a single MySqlDatabase class (with nested classes) that implicitly in the language relate the nesteds' amongst themselves.

    But nested classes are not namespaces. PHP needs a syntax like that of Java mixed with Python, and, being a scripting language, PHP should allow namespaces to be first class language objects that can be manipulated, and they should have clearly defined scoping rules. Example:
    package php.example;
    /* semicolon could mean all the follows is in this package; scoping rules would need careful definition */

    class Test {
    /* the explicit full reference to this class would be 'php.example.Test', but any other classes within this package scope could just call it 'Test' */
    }

    package php.example2 {
    /* using the brace notation would only include what's within the braces, and if we're in a broad semicoloned one like above, this section would be treated separately, but anything afterwards, until either the end of another single-statement 'package' directive would be implicitly in 'php.Example' */

    class Test {
    /* no name collisions with the above because this is 'php.example2.Test' and it is 'php.example.Test' */
    }

    class Test2 extends php.example.Test {
    /* this stuff could be really useful to PEAR */
    }
    }

    package php.example3 {
    import Test from php.example;
    /* now class definition or code can make reference to 'Test' from the php.example namespace */

    class Test2 extends Test {
    /* no name collisions between this 'Test2' and that of 'php.example.Test2', yet 'Test' seems like its local thanks to the import above */
    }
    }
    I admit that the scoping rules could be tightened. For example, after a broad 'package x;' statement, what if you wanted to define the contents of a subpackage using the 'package y { }' syntax but wanted the 'y' namespace to be under 'x' (so that anything defined in y would be prefixed globally by 'x.y.')? Edge cases like that would need careful consideration, and the only thing I can think of at the moment is a separate 'subpackage' keyword that would work in conjunction with 'package x.y.z;' definitions to consider 'subpackage w' to be really referring to a 'package x.y.z.w' definition.

    I just want PHP to be even greater because I love it. I am working to document some of these ideas and the make the case for some more of these kinds of additions to the language, as well as coding the patches against ZE2.0. If anyone would like to share their ideas with me or help me work on this, please feel free to email me at pete (at) petrasync (dot) com (and sorry for some of the misformatted code blocks -- they are a tad difficult to get right.)
    --
    Pete
  73. mod parent up! (A Criticism Of PHP5's Namespaces) by tolan-b · · Score: 1

    can someone at least set the parent of this ( "A Criticism Of PHP5's Namespaces (plz read! :)" ) up tp +1.

    some interesting points, i'm going to come back and re-read tomorrow when i'm a bit more awake ;)

    wish i hadn't caned my moderator points yesterday :/

  74. Re:mod parent up! (A Criticism Of PHP5's Namespace by mccormick · · Score: 0

    I really appreciate your kind words.. I wish I didn't post at 0, but as you can see, I'm trying legitimately to get that up but as well, shed some light on current PHP problems.

    --
    Pete
  75. for beginner programmers... by Vaughn+Anderson · · Score: 1

    For the faint at heart when learning code: The beauty of PHP is that it is very similar to Javascript, Flash 5.0-MX ActionScript, and it works sooo easily in your own webpages. You can almost copy and paste code from Flash, javascript to PHP... (code geeks, forgive the over simplification here, but that's how it feels to a novice like me.)

    I am a multimedia designer(ie, I suck at programming but draw pretty circles, but there are no jobs anymore drawing pretty circles without code to make them spin when clicked on, so now I program too.)

    Also php.net is an incredible resource with /.esque posts on many of the pages of the online manual that are extremely helpful at relating code to reality for beginners.

    Also a bonus, good PHP hosting on Linux is consistently more available and cheaper than on M$ based hosting systems.

    Also, you don't _have_ to actually buy a book to get started with it. :)

    -v

  76. Re:PHP is good but TAL is the next generation of S by Anonymous Coward · · Score: 0

    I've heard of this tag based marketup idea... I think it was called Cold Fusion (or Cold Frustration depending on your point of view)

  77. Re:Using PHP on a professional site by Anonymous Coward · · Score: 0

    Has anyone ever noticed that most developers using scripting languages tend to use mulitple languages, Perl/Python/PHP/Bash et al... what ever is best for the job.

    But teach a guy a little Java he thinks Christ has returned and Heaven is J2EE compliant.

  78. Re:PHP is good by Anonymous Coward · · Score: 0

    So the PH of your poop is on? We've tested it and found it to be not good. You'll need to change your diet immediately.

  79. Re:mod parent up! (A Criticism Of PHP5's Namespace by tolan-b · · Score: 1

    well i did finally get back to read it, and there are some interesting ideas.

    to be honest, the only languages that i've used in an OO fashion are Java and PHP, and with PHP i've always treated it quite like it was java (as much as that is possible), including only having one class per file. i quite like that restriction, as it makes things easy to find, and reduces room for complexity and variations in naming conventions. but as i say, java was really my first introduction to something resembling proper OO, so im probably missing the advantages of what you are proposing :/

    never the less, i'll keep an eye out for you next time i get some moderator points :)