Slashdot Mirror


Learning PHP 5

John Suda writes "There are more new books being published about PHP than you can shake a joystick at. PHP (along with program friends - MySQL and Apache) has become very popular among developers and web designers, and for good reason. As a programming language, it is particularly suited to web development projects, while being relatively easy to write, use and learn. More importantly, it's open-source and free, cross-platform, and widely supported. David Sklar's Learning PHP5 is one of the latest volumes dealing with PHP. It describes itself as 'a Pain-Free Introduction to Building Interactive Web Sites,' and provides a gentle introduction to the latest version of PHP, which is version 5 and only recently available." Read on for Suda's review. Learning PHP 5 author David Sklar pages 432 publisher O'Reilly rating 9 reviewer John Suda ISBN 0596005601 summary An accessible introduction to the popular web scripting language PHP

This book is not particularly useful for those experienced already with PHP, nor for those wanting to upgrade their knowledge of PHP from versions 4 and earlier to the newest version. It's also probably not particularly useful for those power programmers who need and want a deep and comprehensive coverage of the topic. But it is a very well-written and designed introduction to PHP 5 for beginning programmers or those experienced PERL, ASP, or Cold Fusion programmers who want to learn a different language. There are many illustrations and code samples sprinkled throughout the book. Sklar, however, skims over some topics, concentrating instead on practical examples.

The publisher is O'Reilly Media, Inc. which seems to have an editor's policy of covering complex computer-related topics in a comprehensive manner by publishing a range of volumes covering different aspects of a topic or from different angles or for different audiences. O'Reilly also publishes volumes on moving to PHP 5 (Upgrading to PHP 5), detailed and technical PHP (Programming PHP), and a collection of solutions to common PHP programming problems (The PHP Cookbook).

Sklar is an experienced consultant in computer software development and technical training. He is the author of Essential PHP Tools and coauthor of the aforementioned The PHP Cookbook. He takes a deliberate and comprehensive approach to explaining PHP 5, not in great depth, but with the intent of providing enough information, concepts, detail, and scope to create a pleasant and useful read of a technical subject. The basic promise of PHP is in the relatively easy creation of more dynamic and interesting web sites which would include, for example, product catalogs, blogs, photo galleries, event calendars, forms, and more.

There are 13 chapters and 3 appendices. The early chapters provide an orientation to PHP, including its place in contemporary web development, its basic rules, and its syntax. They explain the basic background of PHP and how it interacts with the browser and web server. Later chapters introduce primary concepts like loops, arrays, and functions. The idea here is to facilitate learning the fundamentals of the grammar and vocabulary. Chapters 2 through 12 have short exercises at the end of each to allow the reader to practice writing PHP code and to test learning. (The answers are contained in Appendix C.) Experienced programmers and geeks may recoil at the inclusion of these exercises, but they are useful for beginners.

Chapter 6 provides a practical exercise - how to make and use a web form. The author shows how to access form variables, how to validate user-inputted data for security and efficiency reasons, and how to process forms using functions. Chapter 7 shows how PHP interacts with database programs, like SQL and Oracle, but focuses primarily on MySQL, and demonstrates how to organize data, connect to a server-based database, create tables, and enter and retrieve data.

The rest of the middle chapters cover the use and implementation of cookies and sessions, handling dates and time, and working with files. The practical exercise using dates and times is creating and displaying a monthly calendar. The final chapters provide brief but practical coverage of XML, debugging, and in Chapter 13, other PHP aspects. PHP is amazingly useful, flexible, and practical. One can deal with graphics, PDF documents, and other media like Flash and Shockwave. It also has mailing and file uploading functions, encryption capabilities, and (for more experienced coders) the ability to run shell commands. The upgraded PHP 5 has new capabilities, which now include object-oriented programming.

Appendix A covers installing and configuring PHP for Windows, Mac OS X, and Linux; Appendix B is a short primer on regular expressions and how to use them with PHP.

I found the book to be the most accessible introduction to PHP I have read. It provides the basic fundamentals, engages the reader in practical examples, reinforces learning with exercises, and provides an overall perspective on the scope of PHP programming.

You can purchase Learning PHP 5 from bn.com. (Code examples used in the book can be downloaded at the O'Reilly site for the book, linked above.) Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

201 comments

  1. Two free books on PHP by prostoalex · · Score: 5, Informative
    For the beginners it's worth noting that two PHP books are available for free on the Web (outside of PHP.net documentation).

    A Programmer's Introduction to PHP 4.0 from Apress

    Practical PHP Programming online book

    1. Re:Two free books on PHP by stratjakt · · Score: 0

      Two free books on PHP!
      PHP! PHP!

      Two free books on PHP!
      SILVER SHAMROCK!

      --
      I don't need no instructions to know how to rock!!!!
    2. Re:Two free books on PHP by Anonymous Coward · · Score: 0

      Excellent. I've been looking to learn how to program in PHP but was too cheap to go out and actually purchase something. You've done well young Skywalker.

    3. Re:Two free books on PHP by Anonymous Coward · · Score: 0

      Begs the question of whether you consider PHP programming, or just another Highly Touted Masturbation Language (HTML).
      Had I no self respect, I would just use ASP again.
      One wonders what crayola-ware will eventually replace it...QIQ?

    4. Re:Two free books on PHP by Zach978 · · Score: 1, Redundant

      If you have previous programming experience just go through the PHP Manual on their website, that's all you really need if you're trying to pick it up real quick and know how to program.

      --

      "I told you a million times not to exaggerate!"
    5. Re:Two free books on PHP by Anonymous Coward · · Score: 0

      lol

    6. Re:Two free books on PHP by Anonymous Coward · · Score: 0

      Are these two books available in downladable format for future reference and also for those having slow dial-up connections in develping countries like me?

      Thanks!

      http://www.eParliament.org
      http://giis.netfirms .com

    7. Re:Two free books on PHP by curri · · Score: 1

      I just went and checked, the apress book is avialable in pdf (but they make you download each chapter separately), and the other one is html in a million pages :)

      BTW, the hudzilla book seemed OK, but seems it hasn't been published as a book.

  2. I have a bit of a bone to pick. by gthumb · · Score: 5, Interesting

    See, this is a book review of a PHP tutorial book. This is not an excuse for the legions of Perl bigots to run out here and start bashing PHP based on outdated versions and foolish generalisations. You say that PHP isn't ready for enterprise-ready applications, but this is a pretty transparent falsehood. There's nothing inherent in a proper installation of mod_php to prevent a site the size of Slashdot or Google from running with PHP instead of Perl or, G-d forbid, ASP.

    You say that PHP's "OOP model" "sucks". First off, the term "OOP model" is frankly idiotic. OOP isn't enough of a coherent programming paradigm to be considered a single "model" or "base". Further, only PHP 4 has inferior OOP features. Why? Simply because they weren't in demand. Most people don't need OOP. It's overengineering overkill for the vast majority of applications.

    It's also been alleged that PHP is somehow slower than Perl or Python for Web. However, Perl and Python all have to be compiled before execution, much the same as PHP. It's well known that PHP compilers and cachers already exist, so there's no reason why running the smallest PHP script shouldn't take any more than perhaps a 1/400 of a second. That's a pretty reasonable time, no?

    PHP is maturing. Its version number is the same as Perl; it's more popular than Perl; it's almost as mature as Perl. It has more users than Perl, more bug fixes being put out, and its few idiosyncrasies are very well known. Frankly, there's fewer traps for a beginning PHP user than a beginning Perl user.

    1. Re:I have a bit of a bone to pick. by Anonymous Coward · · Score: 0

      i use perl mostly (sometimes C) and don't care much what anybody else use. i like to stick with perl because i know it very well and it's an awsome all-around language (not just good for web stuff). so because of that i'm not going to learn php but that's because i can already do everything it does with perl. that's not being a bigot, that's just being lazy (or saving my free time to do things other than collect languages).

    2. Re:I have a bit of a bone to pick. by Goaway · · Score: 1

      Wow, a little bit defensive, are we?

    3. Re:I have a bit of a bone to pick. by eln · · Score: 4, Insightful

      I've been programming perl for almost 10 years now. 2 years ago, I got a job where the entire codebase was in PHP. Because of my extensive knowledge of perl, I was able to pick up PHP good enough to become one of the top PHP coders on the team within about 2 weeks.

      Honestly, PHP is MUCH better than perl if you want to write web applications. I still use perl for anything that I need to run from the command line, but for web stuff, it's PHP all the way.

      Now, PHP does have some pretty significant flaws, and perl does a lot of stuff far better than PHP, but PHP is so far superior at doing web-related things that it's silly to write web applications with perl instead of PHP, unless there is some functionality that app depends on that PHP just can't do at all.

      By the way, saying you refuse to even look at another language because the language you use is so damn cool makes you a zealot, whether you want to admit it or not. Any good programmer should be willing to investigate and learn new languages. Nearly every language has its niche where it is better than any other language at doing whatever it does. With PHP, that niche is web applications.

    4. Re:I have a bit of a bone to pick. by Anonymous Coward · · Score: 1, Insightful
      Its version number is the same as Perl
      Next time you should leave that part out, it's quite irrelevant and completely superficial.
    5. Re:I have a bit of a bone to pick. by rainman_bc · · Score: 2, Informative

      Woah silver - Have you LOOKED at PHP5 recently? Inheritence, Overrides, Private Methods and properties, static methods. Looks like a pretty good implementation of OOP.

      And for those zealots who bitch about the fact that everything's a function, dive into Pear...

      The only thing that'll keep php5 from getting into the mainstream is the fact that it doesn't offer too much more other than a much better implementation of OOP, and default installs don't have the mysql package by default - they only have imysql, which means there's a lot of apps out there for php4 that won't work on a default php5 install. Keep in mind in hosted environments this can be a bit of a problem.

      Keep in mind that mysql4-stable doesn't work with imysql yet AFAIK.

      I love PHP5, but the lack of default support for the standard mysql package is bad for many existing apps that rely on that package.

      (yes the onus is on programmers to get their code updated to something like, oh, adodb maybe?)

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
    6. Re:I have a bit of a bone to pick. by Anonymous Coward · · Score: 0

      no zealot is when sombody thinks their favorite language is all that and everybody else should use it. i'm not like that at all. i just don't care what anybody else use to do their stuff, it's their choice and they need to choose what fits their needs.
      my needs are quite well filled with perl and C, and learning other language very similar to those doesn't give me enough return on investment for me to put forth the effort. if i find a language that gives me great returns (like say using lisp for doing A.I. coding) then i'll consider how much it's worth, and then make a decision.
      btw, the few web stuff i do is nicely handled with CGI.pm for casual stuff, or with mod_perl and the template toolkit for complete control over the environment (or mod_perl with Apache::Registry for in-between stuff). i'm not much into web coding though.

    7. Re:I have a bit of a bone to pick. by Anonymous Coward · · Score: 0

      Funny, none of us even piped up. Your opinions on OOP are really most telling -- PHP's OO model must really suck...

    8. Re:I have a bit of a bone to pick. by ahdeoz · · Score: 1

      I'd much rather use PHP, but I'm porting several large webapps to perl because I need mod_perl functionality. The Apache::Registry caching was the clincher, because it was hard to get the PHP caches I tried (not Zend) to always Do The Right Thing. If only the bulk of mod_perl, handlers at all levels, and Apache::Registry could be ported to PHP. I saw some attempts to bring some Apache API functionality to perl, but it looks like it died out a couple years ago. I even emailed the developer who seemed to be in charge. Anyone heard anything about this? I suppose porting to Apache2 and saving the UI part of my PHP code is a possibility.

    9. Re:I have a bit of a bone to pick. by Anonymous Coward · · Score: 0

      The standard mysql pacakge in PHP4 and earlier is the biggest example of everything that's bad about PHP.

      Leaving it out in 5 is a GOOD thing - maybe someone will start to learn about abstraction and encapsulation as a result.

    10. Re:I have a bit of a bone to pick. by hundalz · · Score: 1

      PHP is maturing. Its version number is the same as Perl

      In that case Emacs must be in the great great great great great great great great great grandparents era.

    11. Re:I have a bit of a bone to pick. by bad-badtz-maru · · Score: 1

      No no no!!! modperl is horrendous! Use fastcgi!

      Also, modperl exposes most of the apache API in perl. But you really want to avoid modperl. If for no other reason than the fact that a modperl apache child never returns any perl-allocated memory back to the OS. Your apache processes will, at a minimum, always be above the size of the largest amount of memory you have allocated in perl during that child's lifespan. This is a Bad Thing.

    12. Re:I have a bit of a bone to pick. by juiceCake · · Score: 1

      So you berate so called "Perl bigots" and then follow up in the same paragraph iwht "G-d forbid, ASP." Classy that.

    13. Re:I have a bit of a bone to pick. by ynohoo · · Score: 1

      yeah, it's right up there with MICROS~1 Word in terms of feature bloat...

    14. Re:I have a bit of a bone to pick. by Brother52 · · Score: 1

      I was thinking exactly along the same lines for about four years, happily using PHP for the web, and Perl for the command line.

      Then I discovered the world of mod_perl and Perl web development tools. Boy, I was blown away by availability of rich, well-tested and well-documented solutions to the problems that you have to fight with with PHP all the time. I started with PHP, I loved PHP, but now I can say that good PHP programmer's productivity on medium to large apps is about 1/3 - 1/2 of the same of mod_perl programmer, all other things being equal.

    15. Re:I have a bit of a bone to pick. by Tablizer · · Score: 1

      OOP isn't enough of a coherent programming paradigm to be considered a single "model" or "base".

      Amen! OO's biggest flaw is its inconsistency between one alleged OO guru to another.

      For example, look at all the zealotic fights in the OO community over whether MVC is good and/or whether MVC is OO. Yet companies are investing zillions of dollars in MVC-related frameworks (which are lousy IMO).

    16. Re:I have a bit of a bone to pick. by rainman_bc · · Score: 1

      Oh, I totally agree with you; problem is that there's tonnes of LAMP apps written with the standard mysql package. I can only speculate that though, and don't have a concrete list of them lol...

      Problem is that mysql-stable doesn't work with the imysql package... mysql-stable is still mysql 4.1 last time I checked. In a production environment you need a stable database (granted going to PHP5 is a bit of premature ejaculation IMO).

      --
      09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
    17. Re:I have a bit of a bone to pick. by Anonymous Coward · · Score: 0
      Next time you should leave that part out, it's quite irrelevant and completely superficial.

      Next time you should leave out quite and completely. There's no need to upwardly modify irrelevant and superficial. They stand on their own.

  3. What does it do differently? by colin_n · · Score: 4, Interesting

    PHP4 is to PHP5 as ASP is to ASP.NET? Is that statement correct? What advances does PHP5 make that puts it in direct competition with ASP.NET?

    --

    --------- I have no signature
    1. Re:What does it do differently? by ptlis · · Score: 5, Insightful

      It runs on something other than IIS...

      --
      There's mischief and malarkies but no queers or yids or darkies within this bastard's carnival, this vicious cabaret.
    2. Re:What does it do differently? by ptlis · · Score: 0

      Oh come on, that's not a troll...

      --
      There's mischief and malarkies but no queers or yids or darkies within this bastard's carnival, this vicious cabaret.
    3. Re:What does it do differently? by xoboots · · Score: 1

      Agreed! Particularly in a PHP thread! If I had mod points, you'd get 'em.

    4. Re:What does it do differently? by colinramsay · · Score: 2, Insightful

      Absolutely not. ASP is a scripting language. PHP is a scripting language with string OOP features. ASP.net is a framework for the web, which allows you to use a fully featured OOP language such as C#.

      To be honest, if you've never used ASP.net, then it is difficult to explain the differences. But for the web, nothing else comes close.

    5. Re:What does it do differently? by Foofoobar · · Score: 1

      Objects are no longer called by copying. OObjects are now called by reference.

      --
      This is my sig. There are many like it but this one is mine.
    6. Re:What does it do differently? by colin_n · · Score: 1

      I have used ASP.net and PHP4. I love PHP4 for my personal page and the simple things that I make but for making web pages that feel less like the web and more like a native program, it seems like asp.net has an edge. Does PHP5 attempt to create some of the framework that makes it possible to work with data without page reloads etc... it seems like this is what ASP.net does differently. To me, when I work with some asp.net apps, you load the page once and everything else works in the background without refreshing the page with every submit

      --

      --------- I have no signature
    7. Re:What does it do differently? by styrotech · · Score: 2, Informative

      Absolutely not. ASP is a scripting language. PHP is a scripting language with string OOP features. ASP.net is a framework for the web, which allows you to use a fully featured OOP language such as C#.

      The original ASP wasn't a language, it was a framework too. You could write ASP pages in vbscript, jscript or even perl.

    8. Re:What does it do differently? by Anonymous Coward · · Score: 1

      ASP is a scripting language. PHP is a scripting language with strong[?] OOP features.

      This implys that ASP did not have OOP features. In fact, J(ava)Script has a powerful 'prototype'-based OO system. Even VBScript has basic OO -- about the same as normal VB.

      (It's funny how ASP got such a bad rap from PHPers, but PHP is just now getting many of the features that ASP had years before it went obsolete.)

    9. Re:What does it do differently? by mojogojo · · Score: 1
      I'll address only your first/second question...
      See Zend PHP 5 press release
      this is what's new in PHP 5...
      Summary:

      Zend Engine II has Object-Oriented development features for component-based enterprise applications

      Extended XML support

      Support for web services

      Enhanced Database support

    10. Re:What does it do differently? by FuzzyBad-Mofo · · Score: 1

      PHP5 will not write Javascript for you. If you want the client to "work with data without page reloads", you've got to get your hands dirty. Not that I mind doing that. Generating Javascript via PHP can be fun!

    11. Re:What does it do differently? by Ogerman · · Score: 4, Insightful

      What advances does PHP5 make that puts it in direct competition with ASP.NET?

      PHP5 competes with ASP.NET (and Java) up to a certain point. This is a question of best tool for the job. PHP5 is great for developing interactive websites, CMS/forums/blogs, and other lightweight web applications as suitable for an inexpensive hosted environment. However, PHP5 is still way behind today's Java and .NET platforms for developing enterprise (aka. complex, database-heavy) applications -- whether for the web or otherwise. In many cases, PHP is legitimately the "simplest thing that could possibly work" and is thus an excellent choice. However, the architecture that makes PHP great for RAD and simple web applications also severely limits its usefulness for more complex applications. I say this not off-the-cuff but entirely from real-life experience.

      So it comes down to this: if your application is simple enough, by all means use PHP5. It is a great tool for limited-scope jobs (analogous to VisualBasic for the web perhaps) and its performance and scalability is excellent given its limited-by-design architecture. Simplicity on the low end is PHP's strength.. it doesn't try to do too much for those who don't need it to! On the other hand, if your application is more complex (most business apps, anything accounting / finance related, mission critical databases, etc.) use a modern, lightweight, framework-driven Java approach like Spring + Hibernate. PHP is no longer the "simplest thing that could work" when the application domain has moved beyond what it naturally does well. You can force the use of just about any language for any given task but that doesn't mean it makes sense to. (and spare me the silly politics..)

      Choice is good. What does disturb me is how many open source programmers today think that PHP, Perl, and Python are the answer to everything web-related. They're not. I could name a few dozen projects currently using those language that would be far better off using Java instead. Incidentally, Python is the closest to competing directly with Java's domain, but needs a few more years for its tools to mature.

      http://www.extremeprogramming.org/rules/simple.h tm l
      http://www.springframework.org

    12. Re:What does it do differently? by jbplou · · Score: 1

      You can find a job if know ASP.net

    13. Re:What does it do differently? by The+MESMERIC · · Score: 0, Flamebait

      no you can't
      unless you are from India of course.

    14. Re:What does it do differently? by D-Cypell · · Score: 2, Insightful

      I just want to apply a virtual +1 to this post.

      There is a very subtle line in the sand where PHP becomes 'underkill' and you need to consider moving to a more rounded technology like J2EE or (*spit*) .Net. Experience is knowing where this line is (or better still knowing that the product being developed will cross it in X amount of time).

      There are far too many people using J2EE and .Net style techs for things where PHP would be (and would remain indefinately) the much better choice.

      Also, the other way around, but this seems much rarer...

    15. Re:What does it do differently? by Tablizer · · Score: 1

      Java's frameworks usually stink anyhow. There is way too much coding for otherwise simple things. It is a beurocrat's dream. What is missing from web developement is the VB/Delphi event-driven model where events and properties are closely associated with UI objects/features and easy-to-get-to (not digging around in code). That is the best model for interactive application design that I have seen, and anything that moves away from that turns into a monster.

      The problem is that no current web frameworks get it right because the HTTP protocol makes even-driven design difficult. But it is possible with some compromises.

      A good event-driven framework would tend to be language-neutral such that the use of Java versus PHP for it should not matter much. Perhaps this is why Sun and MS don't persue it more: they lose your language-lockin that funds them.

    16. Re:What does it do differently? by Ogerman · · Score: 1

      Java's frameworks usually stink anyhow. There is way too much coding for otherwise simple things.

      It depends on what your needs are. Some complexity simply cannot be avoided given today's technology. Also, keep in mind that VB/Delphi would also represent "too much coding" if it were not for their RAD GUIs that do a lot of work for you and hide much of the "glue" that holds everything together. On the Java side, you have tools like Eclipse that perform similar functionality, albeit with a bit more developer control. In the end, if you find yourself typing too much, you're not doing something right! A verbose language need not imply more work on the part of the developer.

      Try the Spring Framework + Eclipse + JSF ...

    17. Re:What does it do differently? by The+MESMERIC · · Score: 1

      stupid modding kids. pah.
      would it be Flamebait had I written:

      no you can't unless you are from "Russia/Canada/Japan" of course.

  4. PHP vs Zope, Pearl vs Python by dargaud · · Score: 4, Interesting
    I had to use Perl for a project some time back. It was quick and dirty and did the job. At the same time I learned python without managing to apply it to the project. I recognized that I liked python better, but perl was faster to implement.

    Slightly later I did a web project where some interaction was necessary. Instead of my old cgi-scripts or DHTML, I started it in PHP and Zope, as a newbie in both. While recognizing that Zope seems very clean I was totally unable to wrap my head around its basic concepts ('TAL' anyone ?). In one afternoon I had PHP installed and a 140 pages of PHP converted from HTML, up and running. Going from HTML to basic PHP takes about 5 minutes.

    So, while I regret to say that, some languages look cool but others just do the job. PHP is certainly one of the latter.

    --
    Non-Linux Penguins ?
  5. ASP.NET and PHP5 explained by jbellis · · Score: 5, Informative
    ASP.NET is infinitely better designed than classic ASP. (Not perfect by any means -- ASP.NET should be next to "leaky abstraction" in the dictionary -- but they got a LOT right this time around.)

    PHP5 has more features than PHP4 but is aggressively backwards compatible, thus, with a few exceptions it's as crufty as ever.

    I would pick OpenACS over ASP.NET but I would pick ASP.NET over PHP5 or most J2EE stacks.

    1. Re:ASP.NET and PHP5 explained by Martin+Blank · · Score: 1

      How aggressively backwards compatible? It has been my understanding that a LOT of stuff written under PHP4 will not work under PHP5 without significant rewrites, and that there are no intentions of adding in that back capability. I have not yet seriously tried using PHP5 as yet largely because of this. Can you clarify?

      --
      You can never go home again... but I guess you can shop there.
    2. Re:ASP.NET and PHP5 explained by AC-x · · Score: 1

      Unless you're using certain quirks of PHP4 (that you shouldn't really use if you're following good coding guidelines) then PHP5 is a dropin replacement for PHP4.

      At work we've moved many complex database driven/CMS sites written in PHP4 to PHP5 with no modifications at all.

    3. Re:ASP.NET and PHP5 explained by killermookie · · Score: 1

      Parent post might be a bit misinformed. By the way, what does "aggressively backwards compatible" actually mean??

      Anyways, the biggest redesign with PHP5 is its Object-Oriented Model. It now reflects to what a true OO model should be such as Private and Protected Members, Final, Private, Protected and Static Methods, class abstraction, Interfaces and a standardized constructor and destructor syntax.

      The backwards compatibility comes from everything else with PHP. Pretty much all the functions remain intake though you may need to consult php.net for further information.

    4. Re:ASP.NET and PHP5 explained by justMichael · · Score: 1
      How aggressively backwards compatible? It has been my understanding that a LOT of stuff written under PHP4 will not work under PHP5 without significant rewrites, and that there are no intentions of adding in that back capability. I have not yet seriously tried using PHP5 as yet largely because of this. Can you clarify?
      You can see Backward Incompatible Changes and new keywords for the things that may cause problems for you.

      The biggest issues I can forsee is if you currently use some of the new keywords in your old code. (but I haven't messed with PHP5 yet)
  6. Back in my day... by sleighb0y · · Score: 5, Insightful

    We would learn PHP from the php.net documentation alone!

    And we liked it that way!

    1. Re:Back in my day... by Anonymous Coward · · Score: 0

      We would learn PHP from the php.net documentation alone!

      Back in your day, we would burry the layout of a webapp inside an awfull big c file...

    2. Re:Back in my day... by Anonymous Coward · · Score: 0

      Wow, you must be, what, 15?

    3. Re:Back in my day... by pat_trick · · Score: 1

      If by "back in my day" you mean last week, then yes. I learned PHP straight from the php.net documentation alone for a database project I did for class. Worked well enough for me.

    4. Re:Back in my day... by MonkeyCookie · · Score: 1

      Bah! Back in my day there was no documentation!

      We would figure out what to do by tracing through the assembly code on paper!

      You youngins have it good these days.

    5. Re:Back in my day... by doctechniqal · · Score: 1

      We didn't even have ones and zeros, we had to make do with capitalized O and lower-case L.

    6. Re:Back in my day... by Kehvarl · · Score: 1

      You youngsters had everything so danged easy with your 'lowercase' letters.

    7. Re:Back in my day... by Anonymous Coward · · Score: 0

      Wow, you must be what, a 30 year old virgin living in your moms basement playing D&D with an AI you programed yourself?

    8. Re:Back in my day... by Tongo · · Score: 1

      You youngins, all fancy pancy with your letters. We had sticks and rocks, and we liked it that way!

    9. Re:Back in my day... by Anonymous Coward · · Score: 0

      We had sticks and rocks, and we liked it that way!

      Pfft, solids. You try writting some code down when you're just a mass of vapors.

    10. Re:Back in my day... by Kehvarl · · Score: 1

      You're on the DNF team, aren't you?

    11. Re:Back in my day... by Anonymous Coward · · Score: 0

      Bah! Back in my day there was no documentation!

      We would figure out what to do by tracing through the assembly code on paper!


      Speaking as someone who's spent the last fortnight doing exactly that, I can assure you that the bad old days are not behind everyone yet.

      Remember, kids, open APIs and at least some documentation will make life a LOT nicer for the folks who have to come along and interface with your programs when you're gone.

  7. In fairness to the python community by jbellis · · Score: 3, Interesting

    there are more options for python on the web than Zope, which even many pythonistas consider overengineered and even un-pythonic in many ways.

    WebWare and Quixote are probably the biggest; another called SnakeSkin was just announced as having reached 1.0 today.

  8. open-source vs. suitability to task by Anonymous Coward · · Score: 2, Insightful

    As a programming language, it is particularly suited to web development projects, while being relatively easy to write, use and learn. More importantly, it's open-source...

    So, being open-source is more important than suitability to task?

    1. Re:open-source vs. suitability to task by Anonymous Coward · · Score: 2, Insightful

      It is for me.

      If it's open source and clumsy, it will can always evolve into something better. If it isn't, well, they got your money once, and you better be happy.

    2. Re:open-source vs. suitability to task by Anonymous Coward · · Score: 0

      Too bad languages can't be open source or closed source. Tool implementations can, but not the language itself. PHP is no more "open source" than C# is.

    3. Re:open-source vs. suitability to task by Canberra+Bob · · Score: 1

      "If it's open source and clumsy, it will can always evolve into something better"

      So you would be happy if your bank lost money from your account due to clumsy free software, just so they could use free software out of principle?

      Right tool for the right job. In some circumstances the development team dont have time to wait for the software to mature, nor do they have the resources to help develop said software. They have to work with something that is mature and stable NOW. If that happens to be commercial, so be it.

    4. Re:open-source vs. suitability to task by Just+Some+Guy · · Score: 3, Interesting
      So, being open-source is more important than suitability to task?

      For many of us, being Free Software is "suitability to task". That is, non-Free software is an automatic disqualification from the running.

      I've built my company's web apps on Zope, Python, PostgreSQL, and FreeBSD. None of those "vendors" will go out of business next year (but if they did, who cares?). There will be no forced upgrade to a more expensive version that we don't need. We can get timely (and free) security updates and feature upgrades. We have an infinite-user license.

      How on Earth could a closed vendor compete with that? The answer: they can't. There are far too many Free options for developing network applications to even glance at the proprietary stuff.

      Oh, and my boss likes our system so much that he just gave me permission to release all of the non-business-logic software I've written over the last year under an open source license. The only remaining step is to pick the license that we'll use to share our work with the community that made it all possible. Have I mentioned today that I dig my job?

      --
      Dewey, what part of this looks like authorities should be involved?
    5. Re:open-source vs. suitability to task by Anonymous Coward · · Score: 0

      What amazes me, is, that really, hordes of geeks out there really do think this way.

      Really commonly arguments for Free Software seem to be purely _ideological_, and I can't seem to understand that. It's true that free software has many advantages over proprietary - but IMHO that should be enough. No need for any ideological nonsendes . If a commercial product can outdo an open source program, then it's better, and I see no reason to not use it because it's not "free".

      Really, practicalities aside, does being "free" really matter? (I know many people to whom that ideology is very important)

    6. Re:open-source vs. suitability to task by dioscaido · · Score: 1

      You have many insightful points on your post, but I figured I'd field this one:

      How on Earth could a closed vendor compete with that? The answer: they can't.

      oh, I don't know, possibly by providing a product that actually works, and increases productivity, versus an inferior copy-of-features, slightly usable program.

      That is not to say OpenS software is inferior (plenty are amazing--linux,mozilla,openoffice,etc..), just commenting on your seeming blind adoption of it just because it's OpenS.

    7. Re:open-source vs. suitability to task by Wyrd01 · · Score: 1
      How on Earth could a closed vendor compete with that? The answer: they can't.
      The one area where a vendor can outmatch an open source option is support... and having someone else to blame.

      When your email system goes down, and your biggest customer calls and wants it back up, now, you've got no one to blame with open source except yourself. I've found that sometimes the customer will calm down a bit if you tell them you've got an open ticket with level 2 support at Company X.

      Then, when it takes two days to get them back up and running, and they've lost thousands of dollars of business, you can just give them the number for Company X and let the customer chew them out, instead of you.

      Wyrd-One
  9. For those who like this book by doombob · · Score: 1

    Check out this one as well. I got them both from the local library (amazing that they had them right away) and Beginning PHP5 was a more complete book. I still liked Learning PHP5, but I felt there were things left out. I know the review says that it doesn't go too deep, but I prefer the practical examples in Beginning PHP5.

    1. Re:For those who like this book by Anonymous Coward · · Score: 0

      This one would seem to be a much better choice if one is looking for a comprehensive book that goes beyond what the book currently under review covers.

  10. honest question here... by EZmagz · · Score: 3, Insightful
    With a language like PHP that has a very active developer community associated with it, why plop down for a book like this when websites like THIS ONE exist and give all the documentation that you'd need when learning the language? I realize that it's handy in having a hardcover book to read (hell, I've got my fair share right next to my unemployed ass) and reference...but still.

    Just curious.

    --

    "Hell hath no fury like a woman scorned for SEGA. ..."

    1. Re:honest question here... by Anonymous Coward · · Score: 0

      Possibly because some people learn better with some vaguely organized process that walks them through some basic coding and then builds on it instead of just giving them "here's all the functions and their definitions, have at it"?

    2. Re:honest question here... by ptlis · · Score: 3, Insightful

      php.net is a wonderful reference, even for people who have only the most rudimentary understanding of how to use php but for a total newbie I can see how it could be very daunting; I personally began my way with php scripting by downloading a few pre-made scipts (for an automagically generated image gallery iirc) and realising that none of the three I had grabbed worked and there were features that if worked I would like from each. So I did the obvious thing and (looking up stuff on php.net) cobbled them together into a working set of scripts; problem with this route (and self-learning in general) when compared to traditional/book learning is that not knowing any better you get into some bad habbits which may (and im my case did) come back to bite you when you're more knowledgable. Additionally in getting something to 'just work' you may kludge together some funky code when there's a much easier way you could have done it if you'd read around the subject... I think i've rambled enough but the jist of it is that php.net is an awesome reference if you can't remember the syntax for something but is far from ideal for a newbie trying to learn the language.

      --
      There's mischief and malarkies but no queers or yids or darkies within this bastard's carnival, this vicious cabaret.
    3. Re:honest question here... by e7 · · Score: 1

      We all have different methods or modalities for processing information -- some people get the most from listening to lectures, others from reading, others from doing hands-on, others from dissecting/disassembling things.

      Recently someone observed that I do a lot of handwritten notetaking, highlighting, 'circles 'n arrows.' It made me realize that, for example, I understand code so much better if I print it out, write notes, draw boxes, etc. When I do pseudocode, the ideas flow better if I write by hand, doodle parts of the design (not UML diagrams necessarily) ...

      Basically I have this weird combination of kinesthetic and conceptual learning going on. I just learn a lot better when I can touch something and mark on it. (I used to insist on digital all the way, 'why should I print things out,' but it just seems to help.) It really doesn't bother me, except for those times when I'm just dying to write in a library book :-P

      So maybe someday there will be a selection against kinesthetic learners in the software field and we'll become extinct ... but until that happens, there will always be a market for print: they can kill trees much more cheaply than you can on your own printer.

      --
      Corollary to Moore's Law: The IQ of new computer owners is declining.
  11. The fast way to learn PHP.... by Kenja · · Score: 4, Funny

    The fastest way to learn PHP is to track down David Sklar and eat his brain, thus gaining all his knowledge and abilities.

    --

    "Have you ever thought about just turning off the TV, sitting down with your kids, and hitting them?"
    1. Re:The fast way to learn PHP.... by Anonymous Coward · · Score: 0

      Damn I thought one just had to pick one's brain to gain knowledge - not eat it - Say... his could be another Ferar Factor test what do you think?

  12. Shake a joystick... by Anonymous Coward · · Score: 1, Funny

    There are more new books being published about PHP than you can shake a joystick at.

    Sure you can. I did it just last week. If you want proof, just look at the police report.

    1. Re:Shake a joystick... by Anonymous Coward · · Score: 0

      I didn't know PeeWee Herman used PHP

  13. I read it by Jack9 · · Score: 4, Informative

    When this PHP book appeared in Border's Books last week I read through it to make sure I was still up to speed. I've been programming PHP since 2.0 (back when you could go on IRC and talk with Lars). The book is mostly a verbose rehash of select bits from the documentation by a collection of authors. Wow, described it in one sentence. Didnt seem to have anything over the documentation on the PHP website.

    The bit on XML was interesting as I've never needed to use XML and now have a single practical example to point at.

    The book is not a 9...more like a 6. It's a professional paperback monolith and it doesnt spread disinformation. I don't know what's wrong with the reviewer *shrug* but this isn't a book I'd recommend.

    --

    Often wrong but never in doubt.
    I am Jack9.
    Everyone knows me.
    1. Re:I read it by Jack9 · · Score: 1

      Most people know Rasmus, but he wasnt as available as Lars even back in 1999 :p

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    2. Re:I read it by Zachary+Kessin · · Score: 1

      As PHP books go, I have "Programing PHP", "Web Database Applications with PHP and MySQL", as well as the "PHP cookbook" If I had to pick one of the 3 it would be the PHP cookbook, its wonderful. It has saved me several hours worth of work. Thought the other 2 are also great as well. The MySQL cookbook is also great.

      --
      Erlang Developer and podcaster
  14. Re:but by xoboots · · Score: 0, Offtopic

    Is it my imagination or are the AC's even stupider than usual these days?

  15. Re:PHP or Perl? by Anonymous Coward · · Score: 0

    you should learn perl if it fits your needs
    ditto with php
    don't listen to somebody elses opinion who doesn't know your situation, do the hard work and find out what your needs are.

  16. stuff by Anonymous Coward · · Score: 0

    linux sucks! windows rules!

  17. Re:PHP or Perl? by Flaming_cows · · Score: 2, Interesting

    Er, PHP stands for 'PHP: Hypertext Preproccessor' (gogo recursive acronyms!), not Personal Home Page.

  18. Re:PHP or Perl? by gentoo_moo · · Score: 3, Insightful

    My first programming was in Perl. It was akward but fun. I switched to PHP about a year after I started Perl. I picked up the basics of PHP in about a week. Perl took me a bit longer (like a month for the fundamentals - but I was a real newbie too). Inside two weeks of geeking on PHP I'd written a service ticket program for my private consulting business, did some freelance web coding for another firm and wrote a small checkbook (quicken clone) to get used to it with MySQL.

    After about 3 months of playing with it, I wrote a web-based tracking system that my company uses to manage service calls and billing.

    I think you'd probably pick up PHP pretty quickly. Others may say the same about Perl. This is just my humble opinion.

  19. Help is on the way... by CatGrep · · Score: 0, Troll

    Rails.
    You'll be hearing a lot about it in the coming months.

    1. Re:Help is on the way... by GnuVince · · Score: 2, Informative

      I agree! I recently started playing with Rails, and man it's the funnest thing to build web-based applications! It's easy, fun, simple (you have less code in your controller than some frameowkrs have just for their XML configuration files) and it works very well and very naturally!

  20. Joystick? mysql? by Anonymous Coward · · Score: 0

    Sigh...some people just never get it.

  21. No! by temojen · · Score: 1

    Kuru is bad.

  22. Re:PHP or Perl? by Anonymous Coward · · Score: 0

    It is interesting that you say "it (perl) was awkward but fun."

    My first language was perl too. I didn't know enough about other languages to know whether perl was awkward or not. I had nothing to compare it to. It never even occured to me that perl could be considered awkward until other "more experieced" coders would characterize it that way. Only then did I start to adopt this bias.

  23. Re:PHP to ASP by Anonymous Coward · · Score: 0

    not FLAMEBAIT, sarcasm

  24. Re:PHP or Perl? by Anonymous Coward · · Score: 0
    90 percent of the time you spend learning PHP or Perl will actually be spent learning how to program. It may not feel like it at the time, but whatever language you learn second, you will learn in a tenth the time.

    The problem with PHP is that it is ASS SLOW. If your projects are successful, you will eventually find yourself considering whether to purchase super-expensive machines, rewrite it, or spread the load across many servers, etc.

    Perl is about 10 times faster. Also, Perl has more libraries and example code available, and thus may give you a more marketable skill.

    But C is about 10 to 100 times faster than perl (which is already 10 times faster than PHP). My advice is buy Kernighan and Ritchie's book, print out or buy the GNU C Library manual and examine the examples on safe string handling (asprintf instead of sprintf, for example), and then use Thomas Boutelle's cgic library to do your web programming. Your stuff will be fast, there is nothing you can't do . . . if you find something PHP does that you like, just look at the PHP source . . . after all it is written in C, so just use whatever library or code they use. Future employers and clients will know you can learn any language, because you know the one that they are all written in.

  25. php rocks by opweirdisntit · · Score: 1

    i love php, ive been programming using php for at least 3 years now and no concerns. It rocks as a web dev language and there are so many cool things you can do with it! Even windows programming (GTK :))

    1. Re:php rocks by Anonymous Coward · · Score: 0

      Thankyou for your great insight! I must use this line of reasoning next time I have to recommend a web dev platform.

      I can imagine it now. Stand up and announce "I recommend we use PHP because it rocks, any questions?"

      You have changed the way I view web application development.

  26. Perl will serve you online and off by Anonymous Coward · · Score: 1, Insightful

    Perl does more than produce webpages via mod_perl. It is a powerful general purpose scripting language. PHP is not. PHP was built to spit out html and that is what it is good at.

    1. Re:Perl will serve you online and off by phek · · Score: 1

      that may be what php was designed for but as of early php 4, it's been a great all purpose scripting language. I'd say I use the command line interperter way more than I use it for web pages.

  27. Lots of PHP Book Reviews by MonkeyCookie · · Score: 1

    What's with all the PHP book reviews recently? I seem to recall seeing three reviews within the last several months for various PHP books.

    They must be publishing these things like mad.

  28. Re:PHP or Perl? by justMichael · · Score: 1
    Er, PHP stands for 'PHP: Hypertext Preproccessor' (gogo recursive acronyms!), not Personal Home Page.
    Actually, you are both right.
  29. Re:PHP or Perl? by phek · · Score: 3, Interesting

    Neither is really better than the other, it's really just a preference. Saying that php is a simpler version of Perl is totally wrong. The two languages are nearly as different as can be while still striving for the same goal (ok maybe not THAT different but they are very different). The style differences between the two happen to remind me of the differences between basic and pascal if you're familiar with either of those.

    Some of the reasons I prefer PHP over perl is because it's a lot more similar to C than perl is. Plus, if I remember right with perl, you have to enable execgi in apache for any directory you want to run perl scripts in (something that i'd be very against doing). But probally the main reason me and lots of other people who prefer PHP hate perl is CPAN. CPAN is the perl libraries which you always end up having to update and it can sometimes be a big pain in the ass. The only thing perl has that php doesn't have (that I know of at least) is signal handling, so you can have the code do something if the program receives an INT signal, or any other signal (something you probally wont ever use).

    In my own experience, I learned perl just before I discovered php. Neither language was really hard (I had other experience with non web based languages already), but when learning perl something just felt wrong about the style, awkward as another poster put it.

    So in conclusion... don't do any web programming whatsoever, it sucks and you'll wish you never did. Theres nothing worse than having some asshole who doesn't know anything about computers come up to you and say "The font seems a little strange". Come on... WTF DOES THAT MEAN?!? So then you go and make their website Teal, Orange and Pink because fuck them, and then they come back complaining about the color now, but the font looks good. I still do use PHP though I just try to not do any web programming with it. Both PHP and Perl are great for some simple programs that are just a little too much for a scripting language like bash.

  30. PHP "documentation" is CRAP! by mfearby · · Score: 0, Troll

    How could anybody make sense of what PHP are touting as their "documentation" when it is merely a collection of ramblings from developers who have had all and sundry problems with it over the years.

    Give me good, old, Visual Basic documentation any day - at least you have some examples you can make sense of, without having to read (suffer?) through "writing" by people clearly with a limited grasp of the English language.

    PS, although I prefer the way Microsoft document their programming languages, I personally much prefer Perl as a language.

    1. Re:PHP "documentation" is CRAP! by Anonymous Coward · · Score: 0

      Whoa! Someone actually likes the VB documentation?!?

      Maybe then you can explain why "Methods" and "Properties" each have their own sections rather than being under "Objects"? I could never get past how fundamentally dumb this was.

    2. Re:PHP "documentation" is CRAP! by ScytheBlade1 · · Score: 1

      "documentation"? Yes, I'm *sure* that it's all with ramblings of the programmers.


      I'm sorry, but that's like a troll at it's finest. Granted, SOME pages have issues, but I have yet to find a PHP doc page where if the actal 'documenation' was insufficient, the users didn't comment/correct/fix.

    3. Re:PHP "documentation" is CRAP! by mfearby · · Score: 1

      Why do you label me a "troll" when the PHP documentation is clearly an unprofessional collection of other peoples' ramblings?

      This isn't what I would call a nicely collated and well written reference fit for anybody but the most hard-core, open-source-brainwashed, developer to put up with. There is some open source documentation which is actually good, say, Perl, but PHP isn't very coherent!

    4. Re:PHP "documentation" is CRAP! by Anonymous Coward · · Score: 0

      The only "good" perl documentation I can find is the camel book, which isn't "free" in either important sense.

  31. Re:PHP or Perl? by phek · · Score: 2, Insightful

    Saying perl is 10x faster than PHP is really misleading. Bad PHP may be 10x slower than bad perl, but from my experience good PHP, is just about as fast as good Perl. The thing is PHP just try's to bring over so many functions from other languages, it can be really slow if your using something like the python derived functions. If you try to code PHP like you code C though, PHP tends to be around the same speed as Perl.

  32. Re:PHP or Perl? by Anonymous Coward · · Score: 0

    For most applications, the script speed is irrelvant (see Java). 90% of your bottleneck is going to be the database.

  33. Coming from a background in Bash by Mr.+Flibble · · Score: 1

    I like this book, I picked it up the other week as my new job requires me to work with PHP. 90% of my prior work was all in bash with occasional touches of perl or C.

    I don't understand why people are critical of this book. It is basic, yes, but it is targeted for beginners anyhow. Is it comprehensive? No, but then there are hardly any books that are on a given language.

    Hell, even John Carmack bought the "Camel Book" when he needed to learn perl, and as he said, leigons of people would have laughed, or been shocked when he followed the examples in the book and first wrote "Hello, world!" in perl.

    Everyone has to start somewhere, and this book is geared to be easy from the start. I certanly don't feel like starting PHP by picking up the cookbook first. Will I read it? Sure - but not until I have finished the beginner books.

    --
    Try to hack my 31337 firewall!
    1. Re:Coming from a background in Bash by Anonymous Coward · · Score: 0

      > Hell, even John Carmack bought the "Camel Book" when he needed to learn perl

      He's probably still not a perl whiz ... Doom's not exactly written in perl, yunno...

  34. Re:PHP or Perl? by Camel+Pilot · · Score: 2, Informative

    But probally the main reason me and lots of other people who prefer PHP hate perl is CPAN. CPAN is the perl libraries which you always end up having to update and it can sometimes be a big pain in the ass.

    Uh? >perl -MCPAN -e "install mymodule"

    which will also track down dependencies and install those too.

    Can it be any easier? Activestate has their own set of tools to do the same.

    And you typically install or update modules because there is some spiffy module like Net::SFTP, Math::VectorReal or AI::NeuralNet that provide an amazing amount of functionality in an easy to use interface. CPAN is actually the reason a lot of folks use perl.

  35. Re:PHP or Perl? by ScytheBlade1 · · Score: 1

    "right" is relevant. According to the PHP docs, only the recursive acronym is correct now.

  36. So tell us... by AltGrendel · · Score: 1

    ...what book would you recommend?

    --
    The simple truth is that interstellar distances will not fit into the human imagination

    - Douglas Adams

    1. Re:So tell us... by God_Retired · · Score: 1

      Well, just speaking for myself, after throwing together a little mysql/php scheduling calendar for the local elementary school (my fiance is a teacher there) to learn the language, I bought The PHP Anthology.

      If someone where to ask me about learning PHP, I'd tell them to scratch an itch, using php.net, then buy The PHP Anthology from sitepoint. Great stuff. I think it has been reviewed here before but I'm too lazy to look. Anyway, you can download a couple of sample chapters to see if you're interested.

      IMHO, it's best to look at a language, see what you can do with it, then hopefully before you've developed some shitty habits with the language take a look at how it should be done.

  37. I have the book! by InnerPhalanx · · Score: 1

    Great book, I'm new to dynamic Website creation and the book presents information in such a way I or a more experienced person could both equally understand it. Each chapter has evaluation questions at the end. Good stuff, amazed it made it to /.! Also, the hawk on the book is cool too. =)

  38. PHP vs asp.net by Anonymous Coward · · Score: 0

    I've done development in both asp and asp.net. I have never even touched a piece of php code. I'm curious ... What are some advantages of php and why should I use it vs asp(net)?

    Since there are always (at least) two sides to a story ... disadvantages of php are welcome as well.

    1. Re:PHP vs asp.net by LordLucless · · Score: 1

      PHP 4 is comparable to ASP. From what I've heard (I haven't used it myself) PHP 5 is comparing itself to ASP.NET

      If you have to run it on a non-windows platform, PHP is more suited than ASP - I think there's an ASP module for apache, but I don't think the ASP.NET module and mono are quite working well together.

      Also, there's a heck of a lot of community-contributed code. Something like PEAR is a great resource for extra functionality in your PHP scripts. I also find that there's more free documentation, tutorials and community-based support for PHP than there is for ASP.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    2. Re:PHP vs asp.net by Anonymous Coward · · Score: 0

      Ahem... no...

      PHP V5 is more like JSP than ASP.net ...

      but with some efforts and a decent framework like PRADO, you can get really closer.

  39. Re:PHP or Perl? by phek · · Score: 1

    Yah, but then you run into the issue that any other system that uses this script now has to go install this module. This model of installing modules as needed for a parser is unlike most other languages, and is something most people haven't taken too (based on I haven't seen other languages adopt this). And I agree, the CPAN concept is a leap forward from the "static" libararies of compilers/parsers, but I think it just overly complicates things. Now if there was a CPAN system for other languages where you create binaries, I'd appreciate it much more than for a scripting language.

  40. Job Lobby by Line_Fault · · Score: 2, Insightful

    I love PHP5! I've been running it since the first beta!
    Now if only I could find a job writing it!

    It seems most of the jobs here are ASP related mostly because Microsoft actively sells their product, there is no one selling Free alternatives.

    1. Re:Job Lobby by NardofDoom · · Score: 1
      I found a sweet job programming PHP when all that was listed in the want ads was ASP (which I have zero experience with). Just look up every company in your area that possibly has a web development department, and send them your resume.

      I got hired two weeks after I sent mine in, and I've loved my job ever since.

      --
      You have two hands and one brain, so always code twice as much as you think!
    2. Re:Job Lobby by Anonymous Coward · · Score: 0

      I hope you live in Bangalore, then, else your job will probably be leaving you behind as quickly as you got it.

  41. Re:PHP or Perl? by Anonymous Coward · · Score: 0

    > Yah, but then you run into the issue that any other system that uses this script now has to go install this module.

    Whereas PHP comes with every module anyone will ever need?

    Oh, take a look at Extutils::AutoInstall sometime, which uses a little stub to automatically download, build, install, and use any module from CPAN on first use. You don't even need to install that module, just paste that stub in.

    Incidentally, CPAN borrowed its name from CTAN, the Comprehensive TeX Archive Network. Java has JNLP, etc. But you just in the same breath condemned CPAN as "overly complicates" things. Better duckspeak was never quacked.

  42. you are ignorant by Anonymous Coward · · Score: 0

    To throw out that "OOP isn't enough of a coherent programming paradigm to be considered a single model or base" is just plain ignorance.

    "Overengineering for the vast majority of applications" sounds a bit excessive too!

    Have you ever programmed in a real OO language (like Smalltalk for example)?

    That being said.. PHP is very good for some things like most web sites.

  43. PHP - poor design by TardisX · · Score: 0, Troll

    Disclaimer - I am a perl programmer. However I have my own issues with Perl as well.

    But to the point - PHP. When I am forced to use PHP for something, I am constantly amazed at the poor design and horrific bloat of the language.

    Case in point - there are no less than eleven different sort routines:

    • array_multisort
    • arsort
    • asort
    • ksort
    • natcasesort
    • natsort
    • rsort
    • sort
    • uasort
    • uksort
    • usort

    In contrast, perl has a single 'sort' function.

    One might think that having all these different routines might make it easier to perform a custom sort. Nothing further from the truth - in the end for my fairly trivial sorting exercise I had to revert to using the 'uksort' to sort by a user-defined function - but doing that is far more kludgy than in perl anyway (the sort procedure can't be defined inline).

    Consistently, people who tell me that PHP is 'easy to use' have never used any other language.

    Also consistently, people I talk to who use PHP after having used another language are universally scornful of PHP.

    --

    Command attempted to use minibuffer while in minibuffer
    1. Re:PHP - poor design by drumsetdrummer · · Score: 2, Funny

      Also consistently, people I talk to who use PHP after having used another language are universally scornful of PHP.

      Hmmm... I code J2EE (WebSphere) and I must say PHP is much more graceful than Java. I can send an email in one line of PHP code, but with Java, if I'm not using J2EE, I have to make sure I have the JavaMail and JAF libraries manually installed and then regardless, write or download a wrapper class (with prolly 100+ lines of code) to do something that any language ought to be able to do with a native library.

      I've messed with Perl a little, but after using languages like Java, C, C++ and PHP, Perl is just gross to look at. I know that can be chocked up as a personal preference, but I've heard many other programmers say the same.

      Not to knock Perl -- I know that it has some quick 'n dirty, get the job done capabilities. But then so does PHP. And PHP looks and feels more like a real programming language.

    2. Re:PHP - poor design by LordLucless · · Score: 2, Interesting

      But to the point - PHP. When I am forced to use PHP for something, I am constantly amazed at the poor design and horrific bloat of the language. Case in point - there are no less than eleven different sort routines.

      The number of sorting routines isn't necessarily bad - they're all well documented, and all have differences. I don't think having multiple sort routines slows the language down at all, so I don't see the problem.

      One might think that having all these different routines might make it easier to perform a custom sort. Nothing further from the truth

      That is more of a problem, I think. If coding a customize sort is more difficult in PHP than in an other language, then that's bad. I can't really see how that would be though - implementing a custom sort algorithm doesn't depend hugely on the features of a language - its all basic loops and conditions.

      I code in PHP and ASP.NET. I much prefer ASP.NET - things are much neater, better organized, and there is a clear division between form and content. But you don't need ASP.NET for most sites, and most sites I've done didn't. They needed something quick, simple and fairly lightweight. And PHP worked fine there. PHP is easy to use - if you aren't doing anything particularly hard. It's exceptionally easy to do easy stuff, and hard to do the hard stuff with PHP. So use it for the easy stuff, and use ASP.NET for the easy stuff. Problem solved.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    3. Re:PHP - poor design by Jerf · · Score: 2, Interesting
      If coding a customize sort is more difficult in PHP than in an other language, then that's bad. I can't really see how that would be though - implementing a custom sort algorithm doesn't depend hugely on the features of a language - its all basic loops and conditions.

      That is almost certainly not what the OP meant. Staying language generic, suppose you have an array of two-element arrays:

      [[1, 3], [2, 2], [3, 1]]

      and you want to sort this array by the second element. In Perl, that's
      use Data::Dumper;
      my @array = ([1, 3], [2, 2], [3, 1]);
      my @sorted = sort { $a->[1] <=> $b->[1] } @array;
      print Dumper(@sorted);
      and viola, an array sorted with a custom compare function. In Python,
      array = [[1, 3], [2, 2], [3, 1]]
      array.sort(lambda a, b: cmp(a[1], b[1]))
      print array
      And I can do this in Javascript, C ("man qsort"), C++'s STL (in the verbose way the C++ does things, but still), and at a bare minimum pretty much any language where functions are first-class objects, which with the possible exception of C/C++ I now consider an absolute requirement for any language I will use.

      A language that makes this hard isn't worth using; it's a "smell". Your not knowing this, no particular offense intended, rather re-inforces the original poster's point: The only people singing the praises of PHP are those who aren't terribly experienced with other languages, and it tends to show pretty clearly. (No, ASP.NET is not sufficiently different. Same domain, same basic approach, slight difference in evolution.) As penance, I order you to spend a month with OCaml, for your own good.
    4. Re:PHP - poor design by Davorama · · Score: 2, Insightful
      Well, it's not really that hard in PHP either.
      function cmp($a, $b) {
      return strcmp($a[1], $b[1]);
      }
      $a = array(array(1,3), array(2,2), array(3,1))
      usort($a, 'cmp');
      print_r($a);
      So I guess we have passed the smell test here even if I did obfuscate my code with bad variable name choices. I don't feel too bad about it since you made me read python ;-p.

      Now the real question is how do I get /. to indent my code properly?

      --

      Davo -- Free speech, free software, AND free beer.

    5. Re:PHP - poor design by The+MESMERIC · · Score: 1

      dont compare languages - geez.
      each have their strengths and weaknesses.

      Perl was not written with database-driven dynamic sites in mind.
      PHP was.

      your generalization are pretty silly -

    6. Re:PHP - poor design by NardofDoom · · Score: 1
      I've programmed in Java, JSP, C++, and ColdFusion, and I still love php.

      So blah.

      --
      You have two hands and one brain, so always code twice as much as you think!
    7. Re:PHP - poor design by Jerf · · Score: 1
      Actually, a careful reading of my post shows that being able to do it in PHP is not logically necessary to my point :-) But it is good that PHP can do that, although passing the function by name is another smell.... hmm, let me see... oh, poor scoping ability, which limits the ability (no relevant hits on PHP closure) to use closures (link to a Perl FAQ because it's the best resource I found in 30 seconds; Python, Javascript, and a wide variety of other languages use them). Fortunately, that's not so killer now that PHP has at least some OO support. (You can usually use support for closures or classes to hack enough support for the other to get by.)

      As for "bad variable names", note that in Perl, $a and $b in the sort function are actually mandated by the language... well, sort of, kind of, close enough; "man perlfunc" and look for "sort" for the details. Everything else is a free choice, and short examples call for short names. I guarantee you I haven't written "array" as a variable in many, many years, unless that was absolutely the best name. (And for things like sorting functions, it sometimes is.)

      Indentation is via "ecode":
      an ecode block
      four spaces of indentation
      eight spaces of indentation
      no more
      although it still apparently is a bit kooky, as you can see.
    8. Re:PHP - poor design by wtd · · Score: 1

      Either namespaces or comprehensively object-oriented data types and libraries would do the trick. Namespaces would be less spectacular, but still useful.

      All of these demonstrate a basic redundancy that's rather annoying.

      $foo = "Hello world";
      str_replace("world", "World!", $foo);

      I know $foo is a string. I created it.

      $foo = "Hello world";
      string::replace("world", "World!", $foo);

      Would be slightly better, since the :: takes the place of wondering how the words in a name are separated.

      Even better would be:

      $foo = "Hello world";
      $foo->replace("world", "World!");

      No repeating the type of the variable when any decent compiler or runtime should be able to figure that out, and no wondering where the "subject" occurs in the parameter list.

      Yes, I know, PHP5 has a much better OO model. It still means squat until the standard library actually promotes its use and makes everyday tasks easier and more intuitive.

      Backwards compatibility is a bogus reason for not doing it, too. Those truly concerned with backwards compatibility will use PHP4 anyway, and many will be for quite some time. PHP5 should have been a major departure. The emergence of ASP.NET, and the fact that it meant the closest competitor to PHP was making a huge break from the past, opened up a window for PHP to do the same. I fear that window has been missed.

    9. Re:PHP - poor design by Anonymous Coward · · Score: 0
      Or in Ruby:
      p [[1, 3], [2, 2], [3, 1]].sort_by { |e| e[1] }
      Amazing that any language would force you to go to multiple lines just to do a simple sort that you can describe in one sentence. And no "lambda" in sight.

      And let's compare perl's way of printing a data structure for debugging, etc:
      use Data::Dumper;
      print Dumper($var);
      with Ruby's:
      p var
      Ruby: makes all those other languages look a little goofy.
  44. Re:PHP or Perl? by downward+dog · · Score: 2, Insightful

    Are you really recommending C for web programming (which is 95% of PHP's use)? Unless you're writing Amazon.com, you will spend FAR too long programming and receive little perceivable benefit. PHP is perfect for most web programming; a shopping cart doesn't need to be uber-efficient. Few web apps peg the processor on their server. And if they do, it is not going to be PHP code that will do it -- it will be database or HTTP.

    Not saying that C isn't a great language for some things, but it is not a great language for rapid development of complex web applications. :)

  45. static methods suck and are not really OO by Anonymous Coward · · Score: 0

    the OO solution is class methods..

  46. I think ASP.NET does more by Anonymous Coward · · Score: 0

    before I get flamed.. what ASP.NET gives you is custom tags (your own abstractions, extensibility) that are easy to implement and reuse (JSP 2.0 has this too, they are called tag files).

    This is significant because it allows you to reduce mixing up languages.. and gives you mechanisms that are superior to just templates (PHP has excelent template support).

    I'm not sure PHP 5 has made that leap. Their focus has been improving the OO of the language itself.

    (By the way.. I'm not sure PHP and ASP or JSP are really the same thing.. PHP is a full language, ASP and JSP are, in their modern for, UI description languages which support an additional language as well)

  47. Re:but by loginx · · Score: 0, Offtopic

    It's not your imagination.

  48. Re:PHP or Perl? by phek · · Score: 1

    Oh, take a look at Extutils::AutoInstall sometime,
    Yes, but it's rare to use these modules in PHP, where as it's really common to need a Perl module from CPAN that you don't already have or have too old of a version.

    Incidentally, CPAN borrowed its name from CTAN, the Comprehensive TeX Archive Network. Java has JNLP, etc.
    That would explain why most people who like perl also seem to enjoy java and tex. It's really just a matter of preference whether you like these things, and from what I've seen a lot of people don't. I can give you 100 reasons why each of those things are horrible, and I'm sure you can give me 100 reasons why they're great and the stuff I like sucks, but trying to base an argument (or discussion however you wanna look at it) on other products that are controversal themselves is just bad.

  49. Is that all you can think about?? by Anonymous Coward · · Score: 0

    The "Mine is faster than yours" argument is getting old. "Faster" is rarely a serious consideration these days.. it is just a hold over from more primitive assembly language days..

    Get over it: MOST LANGUAGES TODAY ARE DOG SLOW!!!

    But who cares? MOST MACHINES TODAY ARE EXTREMELY FAST SO YOU DON'T EVEN NOTICE AND YOU SPEND MOST OF THE TIME WAITING FOR THE DB ANYWAY!!!!

    So grow up!!

    1. Re:Is that all you can think about?? by phek · · Score: 1

      Yah, well when you're maintaining a web site that gets enough hits that it require's multiple servers to handle the load, it's pretty important.

  50. Re:PHP or Perl? by Camel+Pilot · · Score: 2, Informative

    I distribute my perl code with the required modules relative to the directory where the application lives. Now all you have to do is add something like this to your code

    use lib ./my_module_dir;

    or

    push @INC, './my_module_dir';

    and perl will look in your private locations for required add-on modules.

    This model of installing modules as needed for a parser is unlike most other languages, and is something most people haven't taken too

    Actually it is similar for every other language including compiled C when using dynamic shared libraries. If you are using additinal modules or libraries you will need to distribute them with code base or be sure they are install in the system area.

  51. php5 Host ? by Anonymous Coward · · Score: 1, Informative

    We found a really good php5 host if anybody is looking. These guys seem to know their stuff.

    http://www.a2webhosting.com/

  52. Re:Word Basher! by downward+dog · · Score: 1

    Well, I regret that you are not a moderator. :) I know HTTP is not a program, but whatever web server is running (e.g. Apache) is going to be a significant part of the workload if the server is facing massive amounts of traffic. Nothing like a database (at least in terms of CPU overhead), but non-database-driven sites get slashdotted too.

  53. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  54. Re:PHP or Perl? by Billly+Gates · · Score: 1

    Php similiar to active server pages are many times faster than cgi perl.

    Reason being is the rendering engine is run in the webserver itself. Not interpretted through a cgi interface.

    My information might be obsolete since I left the IT world in discuss in 2001 so feel free to correct me.

  55. Good book, better teacher by mr.dreadful · · Score: 1

    I was able to attend a "PHP Bootcamp", held by the nice folks at Big Nerd Ranch. David is an able teacher, and I would highly recommend the class to anyone looking to get a leg up on PHP. My only issue was that the book's answers to the chapter excercises were sometimes a bit more complex then they needed to be. More then just answering the question, David models good programming technique, which sometimes made finding the simple answer to "how do I do that?" a bit of a challenge. However, once the answer was determined, I find myself reviewing his coding structure more closely, making his book even more valuable. It might confuse the newbie, although anyone that sticks with it is probably better off for the expereince. David's also a co-author of the excellent "PHP Cookbook," whose other author wrote O'Reilly's "Upgrading to PHP 5." Frankly, I think all three should be bundled together in a "uber-set", as I found them to complement each other nicely. ("Upgrading to PHP5" has a very nice chapter on PHP and OOP) and no, I am not related to David... I really do enjoy these books!

  56. I just had a week of training with the author... by djcatnip · · Score: 2, Interesting

    ... At Big Nerd Ranch, and it was awesome. If you like the book and you want more personal training, they're talking about doing this PHP5 bootcamp again in about 5 months. It's held at a fantastic retreat setting in georgia, so it's fairly free from distraction. If you've tried to find PHP training, you know this is an unserviced market largely, so if/when they offer this class again, jump on it fast.

    I've been about 3 years into self-taught programming with books, open source examples, and trial and lots of errors up until a couple of weeks ago. Now I've got a pretty good grasp on the mechanics of object oriented programming in PHP5, Pear, and the new XML stuff. David Sklar does a great job at teaching the concepts and practical implementation of the concepts.

    I was fortunate enough to be able to migrate my customer facing server to php5 a couple of days ago, so I'm able to benefit from all the new stuff I learned just over a week ago. It's been very cool.

    --
    I make these: http://beatseqr.com
  57. php and programming by chrisranjana.com · · Score: 0

    Sounds good. Lets take php to the masses.

    --
    Chris ,
    Php Programmers.
  58. Learn PHP without a book by kuzb · · Score: 0, Redundant

    With all these books popping up people tend to forget that php's main site has a particularly comprehensive manual that is also chock full of user contributed notes and code snippits. For the beginners, there is a good tutorial there too.

    --
    BeauHD. Worst editor since kdawson.
  59. More PHP suppliments by kuzb · · Score: 2, Informative

    For those interested, I wrote a PHP manual suppliment called phpbar that works in your browser too.

    Yes, yes, it's a shameless plug, but I had a lot of fun putting it together ;)

    --
    BeauHD. Worst editor since kdawson.
  60. Re:PHP or Perl? by LordLucless · · Score: 2, Insightful

    If you really want the ultimate in execution speed, efficiency and flexibility, code everything in assembler. If you see anything you like in a PHP script, simply re-invent the whole thing from scratch.

    If, on the other hand, you are not a masochist, you want to write something quickly and easily, something relatively easy to debug, something that isn't going to get multiple hits per second - use PHP. That's what it's there for.

    --
    Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
  61. Ruby may be the correct answer to PHP by Anonymous Coward · · Score: 0

    Try out http://www.rubyonrails.org/
    Its a simple framework written in Ruby that should be well liked by PHP programmers. You get all the simplicity of of the LAMP stack but using a better designed langugage, Ruby.

    1. Re:Ruby may be the correct answer to PHP by Anonymous Coward · · Score: 0

      Yawn. Ruby is a poor man's Smalltalk, but with an unfathomable drive to try and use every single symbol on the keyboard.

      Oh, and, by the way? The article was about PHP, not language advocacy. Why not tout your personal obsessions elsewhere?

      Hanging out on /. is like hanging out with actors. Every topic you bring up is twisted so as to swing the conversation back to their own egomania... "Speaking about that, you'll never guess what programming language I use!"

    2. Re:Ruby may be the correct answer to PHP by Anonymous Coward · · Score: 0

      What's the point of using PHP when there's Ruby? There's no advantage! So why not bring it up in a PHP discussion?

      And the post was about Rails, not just Ruby. If you don't know what Rails is, and how it differs from the other frameworks, YOU MUST CHECK IT OUT!

    3. Re:Ruby may be the correct answer to PHP by Anonymous Coward · · Score: 0

      yes, my original post was intended mostly about rails. Rails may change the way PHP folks and many others think about web programming. Rails is new and refreshing; not just another thing to compare and argue about.
      btw, I have no connection with the rubyonrails.org project. I just know a good project when I see it ;-)

  62. Re:PHP or Perl? by Anonymous Coward · · Score: 0

    But C is about 10 to 100 times faster than perl

    And what the fuck do you think Perl is written in? Regexen in Perl are just as fast as in C, because Perl regex engine is written in C in the first place!

  63. Any good IDEs? by dioscaido · · Score: 1

    After developing in asp.net in visual studio, and jsp in eclipse, I couldn't imagine going back to the textpad days. What is available in terms of debuggers for php sites? Are we still depending on echo's?

    1. Re:Any good IDEs? by Anonymous Coward · · Score: 0

      Try Komodo, it supports PHP5 and has code completion and tooltips for builtin functions.

    2. Re:Any good IDEs? by NardofDoom · · Score: 1

      I'm looking for a good PHP IDE as well. Bonus points if it runs on Mac OS X.

      --
      You have two hands and one brain, so always code twice as much as you think!
    3. Re:Any good IDEs? by CultFigure · · Score: 2, Informative

      Zend Studio is excellent... well, it's better than anything else I've used over the last 5 years - pico, vi, emacs, Dreamweaver, Quanta, Jedit. It's well worth the money and runs on OS X. If you're on the cheap, go with JEdit and install the PHP plugin.

    4. Re:Any good IDEs? by NardofDoom · · Score: 1

      What's it written in? I tried the demo and it ran sluggishly, even on the peecee they chain me to at work.

      --
      You have two hands and one brain, so always code twice as much as you think!
    5. Re:Any good IDEs? by Anonymous Coward · · Score: 0

      There is a plugin for Eclipse for PHP development called phpeclipse. It's on SourceForge I think.

  64. Hey I bought this book yesterday by The+MESMERIC · · Score: 1

    Before the article appeared here :)

    Yeah nice book - never thought I could learn PHP in almost 24 hours. It feels like a language much better suited for dynamic html.

    Also I am getting to the conclusing PHP is much better than ASP Classical. Well and those are definitely better than that slow-crawling non-compliant over-hyped ASP.NET.

    ASP.NET promised reducing of complexity but ends up adding more than its fine share. Try write an application that is accessible in ASP.NET *and* XHTML compliant - you can't.

    The only thing I like about ASP.NET is threading (click a form, thread -> send an email = pretty fast) - Can ANYONE let me know if Threading is possible in PHP 5?

  65. Re:Mods on crack again! by The+MESMERIC · · Score: 1

    Ah come on you're just jealous.
    Let me mod you down :)
    Right where is my other account ...

  66. Let the war commence! by Anonymous Coward · · Score: 0

    It's the right season, right climate, right time for a holy war!

    I'll start the easy way, by abusing someone elses article: http://tnx.nl/php.

  67. Commented PHP Manual by DoubleSlashNick · · Score: 1

    Books are great in principle. But where is the meaning in paying for a commented PHP manual while beeing able to get this manual for free along with usefull comments on php.net?

    1. Re:Commented PHP Manual by Anonymous Coward · · Score: 0

      Most of the world still likes to take a book to the shitter. Most of the world still reads in bed at night. Most of the world still likes to go sit on a couch or a comfortable bed. Most of the world doesn't like to sit down and read a book electronically.

  68. shaking joystick by lemody · · Score: 1

    "There are more new books being published about PHP than you can shake a joystick at."

    I wouldn't be so sure after a 1000m run in 'Track & Field 2'.

    --


    class he-man extends man!
  69. Upgrading mah brain by OmahaVike · · Score: 1

    This book is not particularly useful for those experienced already with PHP, nor for those wanting to upgrade their knowledge of PHP from versions 4 and earlier to the newest version.

    okay, so can someone point me to some books intended on bringing an existing ver4 developer up to ver5?

    1. Re:Upgrading mah brain by onlyjoking · · Score: 1

      http://www.oreilly.com/catalog/upgradephp5/index.h tml

  70. Coming from a Perl background... by ralphch · · Score: 2, Insightful

    and having coded all my web applications in Perl, until recently, I decided to implement PHP on a fairly lightweight Bookfair system. I built it using a complete OOP framework and it's running amazingly well. As for the overbloated PHP design (twenty functions for the same thing), I hear you. All I can say is keep consistency in your code, limit yourself to a handful of functions. And hope, eventually, PHP will mature even further. Then again, it's mostly about 'how' you code rather than 'what' you use to code.

  71. Smalltalk is DEAD! Move on! by Anonymous Coward · · Score: 0

    Have you ever programmed in a real OO language (like Smalltalk for example)?

    SmallTalk is dead, Jim. Get over it.

    1. Re:Smalltalk is DEAD! Move on! by Anonymous Coward · · Score: 0

      That's right.. use Ruby instead.

  72. Hopefully ISPs will upgrade one day by edxwelch · · Score: 1

    I'd like to use PHP 5, unfortunately all ISPs seem to still be using PHP 4 (the server I wrote for reciently actually had 4.1)

  73. MOD UP! by Anonymous Coward · · Score: 0

    why is this a troll??

    Try rails today (just watch the intro video. don't do anything else just look at the video!).

    Unless you get paid by the hour and don't have to maintain software after you write it, you will be wondering WHY THE FUCK you spend any time with PHP or Struts or any of these joke frameworks.

    Seriously.

    Just watch the video.

  74. Re:I just had a week of training with the author.. by Anonymous Coward · · Score: 0

    Do they still give the complimentary "private massages" after every talk at BNR? If so they are DEFINITELY worth it even if you're not interested in the subject matter.

    I'll never forget that beautiful Japanese girl. She was so small and delicate but her hands were so skilled and strong.

  75. What is the biggest thing written in PHP? by Heywood+Jablonski · · Score: 1
    OK, now. We all know of at least one really big system written in Perl that works pretty damn well (Slashdot).

    What are examples of really big systems written in PHP that work well?

  76. That's to remind you... by Anonymous Coward · · Score: 0

    of how slow PHP is.