Slashdot Mirror


Spring Into PHP 5

Michael J. Ross writes "A professional programmer could at any time be tasked with developing a nontrivial application using a language or Web technology with which he or she is unfamiliar. A common response is to quickly scan code snippets in Internet newsgroups and online tutorials, copy and paste code that looks applicable to the task at hand, and then lose valuable time trying to make it all work and control what was created -- not unlike Dr. Frankenstein's experience. A smarter approach is to learn the language basics in sequence as rapidly as possible, not getting bogged down in excessive sample code. For developers seeking to learn PHP using the latter approach, Steven Holzner's Spring Into PHP 5, published by Addison-Wesley, would be an excellent choice." Read on for the rest of Ross's review. Spring Into PHP 5 author Steven Holzner pages 340 publisher Addison-Wesley rating 8 reviewer Michael J. Ross ISBN 0131498622 summary A comprehensive and no-nonsense primer on the basics of PHP.

This title is another entry in Addison-Wesley's promising "Spring Into" series, which, as suggested by the name, is aimed at developers who want to jump into a new technology and get up to speed as quickly as possible, but without missing any of the essentials. In the case of Holzner's PHP book, this goal is pursued by presenting the information in so-called "chunks," with each spanning just a few pages. Every chunk attempts to cover only one or a few related ideas, and is designed to build upon earlier chunks. The bulk of the explanation takes the form of code samples, which fortunately are short enough in length and clear enough in composition to be easily digestible. This is in stark contrast to far too many other programming books on the market, whose code samples can span multiple pages, making it difficult for the reader to discern all of the ideas that the author is trying to get across -- especially when the reader has to flip back and forth between pages. Even worse is how some authors (such as Deitel and Deitel) use lengthy code listings -- sometimes even complete applications -- to demonstrate many ideas at once, which can be quite confusing, especially for the newbie reading about a challenging language for the first time. As Holzner notes in his preface, his book is example-oriented, with dozens of tested code samples. But none are overwhelming.

Spring Into PHP 5 was published on 12 April 2005. It is organized into nine chapters, covering a range of topics: PHP essentials; operators and flow control; strings and arrays; functions; PHP in HTML pages; Web forms and input validation; object-oriented programming and file handling; PHP and databases; cookies, user sessions, FTP, e-mail, and hit counters. The book has two appendices. The first one, on PHP language elements, is remarkably complete, considering that it only fills 18 pages. Owners of the book will likely find themselves turning to this material quite frequently. The second appendix lists the most commonly used functions in PHP, particularly those dealing with arrays, strings, and files. These two appendices combined go a long way to making this book more than an approachable primer -- it could serve as a reference book for the language for any reader not required to dig into the more obscure intricacies of PHP. Readers with those needs will have to use more detailed sources, such as the online PHP Manual.

Each one of Holzner's chapters explains the core concepts, using the bite-sized chunks mentioned earlier. This approach is somewhat similar to the "recipes" found in many books published by O'Reilly Media, and it works well here for introducing a computer language. Holzner's writing style is clear yet never condescending, and concise yet never cryptic. The intended reader only really needs an understanding of simple HTML and how to edit text files, to make this book worthwhile and usable. The book is meaty with information, and yet not too lengthy. This is a refreshing change of pace from countless other computer language books that are bloated with redundant sample code and overly wide margins, apparently in an attempt to entice the consumer with maximum page count per dollar.

Some programming books try to move the novice along at too rapid a pace, which can get quite discouraging if and when the reader is unable to follow the discussion, and particularly if trying to follow the author in building a working example. But a far more common mistake among programming books, is to drag out the process with humongous code listings or redundant verbiage (such as following the senseless rule of telling the reader something three times -- a technique that makes far more sense for speechwriting). Holzner sets and maintains an excellent pace, partly by keeping the code snippets reasonably sized, and partly through his modular approach of presenting ideas in chunks.

The physical book itself is well made and attractive, with a readable font face and size, and intelligent use of bolding to highlight those lines of code upon which the reader should focus. My only complaint in terms of the presentation, is that the gray background used for the code samples could be lightened up a bit, to make the text itself stand out more, especially the bold text. All of the screenshots are in black-and-white, which works just fine, as there would be no value in using color in the majority of the sample Web pages.

The author does an excellent job of explaining and illustrating all of the most commonly used and needed elements of the language. But he provides little guidance as to when a particular technique or approach should be used over another. For instance, when explaining how the programmer can use PHP to connect to a MySQL database, the author presents two alternatives -- direct layer and Pear::DB -- but no recommendations as to the choice of one over the other. On the other hand, one might argue that to include recommendations of techniques, as well as language best practices, would require the book to be much longer than it is, which would detract from the book's goal of getting a programmer up to speed on PHP in an efficient manner. The serious programmer who wishes to take PHP to the next level, can be expected to read more advanced books, to learn from expert PHP developers posting in online newsgroups, and to learn from experience as the programmer creates his or her own applications.

Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP). But the database chapter, number 8, provides just enough information for the beginner to get started and to try out the basics. For simple database needs, the material in that chapter might be sufficient. Yet for more extensive MySQL usage, including installation and administration, other resources will need to be consulted. This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

The publisher's Web site for the book does not appear to have any collection of errata. Here are some that I found: On page 6, in the NOTE, "scripts can be used" should read "scripts cannot be used." On page 20, "#/ message to the user" should read "# message to the user." On page 49, in Table 2-4, in the last line, the formatting is partly wrong. Examples 3-1 through 4-14 contain incorrect indentation. On page 158, the last line in the $_FILES['userfile'] values is missing $_FILES['userfile']['error']. In Examples 5-19 and 5-20, the <head> and <h1> tags are missing ": Take 1." On page 169, the formatting of Example 6-2 is inconsistent with the others.

Aside from the errata, there were some other weaknesses -- none of them serious: The chapter summaries are useless, like in most other technical books, as there's not enough details to be instructive, and more details would make them even more redundant and space-consuming. On page 176, in Figure 6-6's caption, "Navigating" should be "Redirected." On page 197, the discussion of HTTP authentication is too brief to enable the typical reader to implement it. For instance, there is no mention of where to set $_SERVER[ 'PHP_AUTH_USER' ] to make it work. Chapter 7, on object-oriented programming and file handling, should be split into two chapters. Combining them makes no sense, and the author does not even transition from the first topic to the second.

Like others in the "Spring Into" series, this title is reasonably priced, at only $29.99 list for over 300 pages of quality material. The publisher, Addison-Wesley, has a page on their Web site devoted to the book, which includes a book description, a table of contents, an index, source code from the book, and a link for downloading a sample chapter (in PDF format), namely, Chapter 3, which covers strings and arrays. The site also has a link to a bonus chapter (also in PDF) that explains how to draw graphics interactively on a Web server and then send them back to the browser. Oddly enough, the page's title is "Spring Into PHP 5 - $20.99," but there's no indication as to how to get the book for only $20.99. That could simply be a typo. But there is a link to purchase the book online for $26.99. For those looking to spring into Web server-side development in general, or PHP in particular, it would be money well spent.

Michael J. Ross is a freelance writer, computer consultant, and the editor of the free newsletter for PristinePlanet.com. You can purchase Spring Into PHP 5 from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

229 comments

  1. wtf? by Karaman · · Score: 2, Insightful

    A professional programmer will never do the stupidity described in first paragraphs when dealing with new language and/or tool to perform task at hand. Although the book might be the best for beginners and advanced users, A PROfessional will not need it at all.

    --
    sex is better than war!
    1. Re:wtf? by SolitaryMan · · Score: 0, Flamebait

      A PROfessional will not need it at all.

      Mostly because PROfessional will not need PHP at all...

      --
      May Peace Prevail On Earth
    2. Re:wtf? by Karaman · · Score: 1

      Well, It depends what you do and how you do it. I use only Delphi and PHP to code for living, although I also know Java,C,C++,Perl,Python. The point is my clients want things to be done fast and furious with as less debugging as possible. And I primarily do web-sites and business software (auditing, etc.). I have practically coded for living in Delphi since delphi 1.0 ;) and PHP for 3 years without stopping. If I have to switch to any other language I can do it in 1 day only (assembler,basic,lisp,fortran and similar excluded). But why should I do it? Why should I reinvent the wheel? I will get no profit :P. I could only reduce coding costs by moving to oss tools. Practically to me there is no difference what language I use, I just write the one I know I will finish the job properly and on time and will be useful to the client for years to come.

      --
      sex is better than war!
    3. Re:wtf? by w98 · · Score: 1
      will be useful to the client for years to come.

      Funny, I just spent 4 months rewriting some code written in PHP 3 (which only a few years old) 'cause it wouldn't work 100% of the time on the new hosting server they needed to move the application to, 'cause the dope(s) that wrote the original software wrote it in such a way that PHP4 choked on it far too often (mostly with the register_globals or other such things being turned off/on).

      In the end, they have a much more secure application that also runs a lot quicker... and since cutting out function calls that will be removed once v5 hits the mainstream, less likely to break down again in the near future.

      <?php include ("mytwocents.php") ?>

    4. Re:wtf? by poot_rootbeer · · Score: 1

      Mostly because PROfessional will not need PHP at all...

      Oh good, I was hoping this book review could serve as a springboard for Yet Another Language Advocacy Flamewar. Thanks for not letting me down, SolitaryMan.

      You jackass.

    5. Re:wtf? by Karaman · · Score: 1
      Well, PHP is only an interpreter. Of course, code will need changing one or two things when migrating, but one should not be forced to change the whole mechanism of the program in the process :). on/off registered_globals are too easy to repair in php, just use something like this (you can evolve it if you need security and so on).
      foreach ($_GET as $s=>$v) {
      ${$s}=$v;
      }
      foreach ($_POST as $s=>$v) {
      ${$s}=$v;
      }
      If you look at the PHP5 manual for classes and objects you will read this: For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class. Effectively, it means that the only case that would have compatibility issues is if the class had a method named __construct() which was used for different semantics. Well, when the old method of using class_name() for constructor becomes obsolete and not supported in new versions, no php4 classes will work :). Some people will have to rewrite the classes constructors :)
      --
      sex is better than war!
    6. Re:wtf? by eyeye · · Score: 1

      Whoa i worked with people who would copy stuff off the web, fail to understand it and spend 10x longer trying to get it to work than it would take a real developer to just write it.

      Still, professional programmers probably don't use PHP at all - i've never met one who does.

      --
      Bush and Blair ate my sig!
    7. Re:wtf? by w98 · · Score: 2, Informative
      foreach ($_GET as $s=>$v) {
      ${$s}=$v;
      }
      foreach ($_POST as $s=>$v) {
      ${$s}=$v;
      }
      ... also written in a single line as
      extract($_GET);
    8. Re:wtf? by baadger · · Score: 1

      Or use the htaccess line:
      php_flag register_globals 1

    9. Re:wtf? by Bogtha · · Score: 1

      A professional programmer will never do the stupidity described in first paragraphs when dealing with new language and/or tool to perform task at hand.

      You're kidding, right? I've worked with professionals that do nothing but that. It's especially prevalent in the web developer community.

      A professional is just some guy who manages to get paid to do it. Amateurs do it because they like doing it. Don't be so quick to hold professionals up as some kind of shining example for the amateurs.

      --
      Bogtha Bogtha Bogtha
    10. Re:wtf? by tha_mink · · Score: 3, Insightful

      Still, professional programmers probably don't use PHP at all - i've never met one who does.

      So then, all the enterprise PHP you see out there (that's right I said enterprise PHP) must be written by amatures?) So like...Yahoo is just a bunch of retards? Do you not notice how much of the really advanced web-apps are php these days? It's like some guy who writes machine code saying..."yeah....perl is just for dummies". Cmon Idiot!

      A better point would be that PHP is so easy to learn and flexable enough to do POORLY, that anyone with a logical brain, a book, and a text editer can "code" a simple widget.

      PHP is here to stay. Get over it!

      --
      You'll have that sometimes...
    11. Re:wtf? by ve3oat · · Score: 1

      Please, what does "PHP" stand for? Thanks.

    12. Re:wtf? by Bloke+down+the+pub · · Score: 1

      If words only have one meaning, and professional only means you get paid for it, what's the definition of unprofessional conduct? Forgetting to cash your paycheck, perhaps?

      --
      It's true I tell you, feller at work's next door neighbour read it in the paper.
    13. Re:wtf? by Anonymous Coward · · Score: 0

      *whistles, shifts eyes side to side...*

  2. PHP Infinity Loop by SupaDupaKoopaTroopa · · Score: 0, Offtopic

    Thousands of website admins are stuck with a PHP recursion attack: "PHP = PHP Hypertext Preprocessor = PHP Hypertext Preprocessor = PHP Hypertext Preprocessor = PHP Hypertext Preprocessor"...

    1. Re:PHP Infinity Loop by Anonymous Coward · · Score: 0

      1. Invent Personal Home Page
      2. Rename it to an very innovative and hilarious acronym
      3.Claim it is a professional tool, not a toy for clueless 14 year olds
      4. ???
      5. Profit!!!

    2. Re:PHP Infinity Loop by Anonymous Coward · · Score: 0

      They seem to be stuck on step four...

    3. Re:PHP Infinity Loop by a1ok · · Score: 1

      I see you haven't heard of HURD :-)

  3. I enjoy PHP ... by w98 · · Score: 1
    ... but it's hard to be considered an 'expert' in a simple language like PHP when everyone and their uncle is writing in it and claims they're also an expert.

    So I always try to learn the more complex ideas around the language or bring in ideas from Perl or C to my PHP code to make it look more advanced... so I tend to stay away from "learn ___ quickly" books -- I already know the basics of a lot of different languages and products, I want the more advanced stuff.

    Here at work, just about every one of our developers can code in PHP ... Perl is a different story, and I guess that's why I make the big(ger) bucks.

    1. Re:I enjoy PHP ... by Momoru · · Score: 3, Insightful

      or bring in ideas from Perl or C to my PHP code to make it look more advanced

      Who are you trying to impress? Why don't you just write whatever PHP you need to get the job done, no one cares if your code looks more advanced, it drives me nuts when people have this mentality in my office.

    2. Re:I enjoy PHP ... by Mr.+Underbridge · · Score: 1
      Who are you trying to impress? Why don't you just write whatever PHP you need to get the job done, no one cares if your code looks more advanced, it drives me nuts when people have this mentality in my office.

      Yeah, that crap drives me nuts. What are these "advanced concepts" anyway? "For" loops?

    3. Re:I enjoy PHP ... by Dakrin1 · · Score: 1

      agghh. It's people like you that give me a headache. Using 'advanced' techniques that are hard to understand, and harder to debug when a simpler technique would be more fitting and elegant.

    4. Re:I enjoy PHP ... by Anonymous Coward · · Score: 0

      Yeah, because high-quality programming is complicated. If it's easy, it must be terrible and useless.

      Maybe you just don't like people cutting your grass.

    5. Re:I enjoy PHP ... by jo42 · · Score: 1
      Ah, you must be of the "lets slap some sh*t together" school of development...

      Keeps many a Real Developers employed cleaning that cr*p up.

    6. Re:I enjoy PHP ... by databyss · · Score: 1

      "Perl is a different story, and I guess that's why I make the big(ger) bucks."

      It took me a day to install a Perl interpreter and start writing programs to parse several hundred text files.

      When did Perl become hard to learn?

      --
      Hmmm witty sig or funny sig? Maybe elitest techy sig!
    7. Re:I enjoy PHP ... by guaigean · · Score: 1

      bring in ideas from Perl or C to my PHP code to make it look more advanced...

      You, sir, are a detriment to coding. By using more advanced looking code, rather than equally simple and equally effective, you are hurting yourself, your employer, and whoever has to clean up the mess you leave behind. It's easy to write supremely complex code that no one will understand in a week. I do it all the time in Perl, and if I don't thoroughly comment it, I forget what it did. The difficulty is in writing elegant, clean code which is easily understandable by whoever will eventually replace you.

      --
      Microsoft Sucks, F/OSS Rocks. I get mod points now right?
    8. Re:I enjoy PHP ... by w98 · · Score: 1
      Exactly... I've had more freelance projects to fix or alter other people's code than to write stuff from scratch. And I'm happy to do it: it's usually a long task, and I charge per hour.

      And the quality of writing something from scratch, correctly, the first time, is way more valuable to someone, than some high school script kiddie that thinks he's "1337" for cutting and pasting someone else's ideas together as a band-aid solution to a problem.

      And now, at my current job, I get assignments like "rewrite 90% of this code to make it more efficient" where someone threw something together that, while functional, isn't the most efficient way of doing something.

    9. Re:I enjoy PHP ... by justMichael · · Score: 2, Insightful
      So I always try to learn the more complex ideas around the language or bring in ideas from Perl or C to my PHP code to make it look more advanced...
      So you intentionally make your code hard to read/maintain so that you can justify your salary? If you really think your code "looks more advanced", chances are it's not.

      Is one of these more advanced than the other? Or does it just look that way to someone that's never seen a ternay operator before?
      if ($a == $b) {
        $c = $a;
      } else {
        $c = $b;
      }
       
      $c = $a == $b ? $a : $b;
      It's a much better plan to justify your existance to your employers by writing rock solid code that can be maintained by others when your l33t skillz get you a better job.

      There is also a huge difference between being able to write code in a given language and being able to write GOOD code in that language.
    10. Re:I enjoy PHP ... by Momoru · · Score: 1

      Theres a big difference in making something more advanced and making something look more advanced. The grandparent simply wanted his stuff to "look" impressive. And mixing a bunch of shit in there to make something look impressive is exactly the kind of thing you probably end up cleaning up.

    11. Re:I enjoy PHP ... by nocomment · · Score: 1

      hehe ya I remember the first commercial use of PHP and it kept spitting things out with escape chars (e.g. " became \") so i jsut created a counter and a loop that printed it out character by character and skipped printing the \. Very innefficient to say the least. Months later I learned about stripslashes(). oops. :-p

      It's funny to look back at that ancient code in horror and wonder how I managed to get anything working at all. Some of my code you wouldn't know it worked if you read it before running it (but if you read it you would not have run it).

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
    12. Re:I enjoy PHP ... by w98 · · Score: 3, Informative
      Okay, so I suppose I should have re-read my post before hitting submit ... my bad.

      What I truly *meant* was: so many people out there are writing very basic-looking code, that, while it works, it's not optimal. It's not as efficient as it *could* be, and in my experience, writing more efficient code, especially code that's "hardened" or more secure, takes more advanced programming skills than a lot of the code I see out there. So, learning complex ideas, which you may NOT learn in these "learn ___ quickly" type of books, sometimes only comes from principles you've learned while writing in other languages. "Looking" more advanced, which I admit was poorly written in my original post, doesn't mean purposely obfuscating code for any kind of job security, but sometimes it's more efficient to write it in one way than another.

      Take regular expressions for example... you could write 100 lines of PHP code to do strstr() calls in a giant if/elseif/elseif/elseif block to detect a string match in a block of data, or you could do a few lines of an ereg_* or preg_* call in PHP that "new" PHP programmers maybe wouldn't know about. If I didn't know Perl well enough to know regexp's, then I wouldn't have known that an ereg_ or preg_ call in PHP would do the same, and 5 or 6 years ago, *I'd* have been that guy writing 100 lines of strstr() calls to do what a single function could perform. Today, I work at taking someone else's 100 lines of code and reduce it to a much shorter block of more efficient code, using more advanced skills.

      And based on conversations I've had with other people, yeah, many people do find Perl a little more difficult to learn with some of its cryptic syntax.

      Sorry for the confusion of my previous post, and thanks for the laughs I've had over other people flaming my trigger-happy 'submit' skills.

    13. Re:I enjoy PHP ... by Anonymous Coward · · Score: 0
      Or to make it even simpler:
      $c = $b;
      What do I win?
    14. Re:I enjoy PHP ... by guaigean · · Score: 2, Informative

      Thanks for the revision, it does help. Using advanced LOOKING code is indeed useless, but there is something to be said for efficient and elegent code that is also sensibly readible. It is indeed what makes the difference between sloppy and supreme coders. Thanks for the clarification, and apologies for being one of the "...people flaming my trigger-happy 'submit' skills."

      --
      Microsoft Sucks, F/OSS Rocks. I get mod points now right?
    15. Re:I enjoy PHP ... by eyeye · · Score: 1

      Maybe he meant learn properly rather than just install and get a program to run.

      --
      Bush and Blair ate my sig!
    16. Re:I enjoy PHP ... by w98 · · Score: 1
      Perhaps read my followup ... I didn't explain myself clearly enough in my original posting. I never write code to look 'impressive' (nor did I say or imply that in my original post) - there's nothing to gain by that...

      The point that obviously didn't come across well was that sometimes these books cause people to write inefficient code because of the simplistic approach they take in an effort to learn something quickly. And if the book becomes popular, then they've just trained people to write huge amounts of simply-written code, that while it looks okay and runs and operates as intended, may not be the best way of doing things (read my strstr and regexp analogy in my followup).

    17. Re:I enjoy PHP ... by hazem · · Score: 2, Funny

      simpler technique would be more fitting and elegant

      This is GOTO, an elegant statement for a more civilized age.

    18. Re:I enjoy PHP ... by databyss · · Score: 1

      I wouldn't exactly call it a small program... more a collection of small programs to handle a larger task. Either way, it involved alot of concepts that go beyond the basics.

      I guess you consider programming properly to mean a large program?

      I'm a firm believer in the "if you know how to program properly, you can use any language" theory, and it seems to work fine for me.

      I don't really have a language preference. I pick what is useful for the situation.

      --
      Hmmm witty sig or funny sig? Maybe elitest techy sig!
    19. Re:I enjoy PHP ... by a.d.trick · · Score: 1

      I agree that the first is more readable to the beginners, but I (personally) would find the second line a lot easier a quicker to read (and I am hardly an experienced programer).

      I don't buy the arguement that we should code so that newbies can read it easier. There's a reason programers don't use BASIC anymore.

    20. Re:I enjoy PHP ... by Anonymous Coward · · Score: 0

      > This is GOTO, an elegant statement for a more civilized age.

      "Is the GOTO statement more powerful, Master Yoda?"

      "Hmph. No. Simpler; easier, more seductive!"

    21. Re:I enjoy PHP ... by It'sYerMam · · Score: 1
      "I never write code to look 'impressive' (nor did I say or imply that in my original post)"

      "to make it look more advanced..."

      I'm sorry, but no. Never mind misunderstanding or lack of explanation - you must have made a freudian slip.

      --
      im in ur .sig, writin ur memes.
  4. PHP now obsolete? by Colonel+Panic · · Score: 0, Flamebait

    Isn't PHP obsoleted by Ruby On Rails?

    Is the book publishing industry becoming irrelevant? By the time the books come out the technology is often on the way down.

    1. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      No because RoR is a boxed in approach. PHP still rules in that arena.

    2. Re:PHP now obsolete? by lukewarmfusion · · Score: 1, Insightful

      Let's see here...

      1. Professional developers are still creating websites using font tags and other deprecated nonsense.
      2. Programmers are writing extensive web applications entirely in Perl cgi, often taking months to do simple tasks that PHP or ASP can do in days.
      3. Existing sites are built on technologies that may be ten years old. They don't update their software every time a new technology, framework, or component comes out. They have to support old stuff in addition to building new stuff.

    3. Re:PHP now obsolete? by ch-chuck · · Score: 1

      There's been a few articles about LAMP losing market share recently.

      --
      try { do() || do_not(); } catch (JediException err) { yoda(err); }
    4. Re:PHP now obsolete? by CatGrep · · Score: 1

      RoR is a boxed in approach How so?

    5. Re:PHP now obsolete? by Dystopian+Rebel · · Score: 1
      Isn't PHP obsoleted by Ruby On Rails?


      AJAX really changes the game.
      --
      Rich And Stupid is not so bad as Working For Rich And Stupid.
    6. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      I know engineers who still program in Fortran 77! So it may take a while for PHP to die...

    7. Re:PHP now obsolete? by Christianfreak · · Score: 2, Insightful

      2. Programmers are writing extensive web applications entirely in Perl cgi, often taking months to do simple tasks that PHP or ASP can do in days.

      Myth #4349: Perl takes longer to develop than PHP

      Obviously you've never heard of CPAN or done anything more than pull some data out of a database and put it on a webpage. Anyone doing anything more than that on the web has to know something besides PHP since doing anything complex in PHP simply isn't very easy at all.

      Personally I really hope the PHP fad will be over soon since I'm not holding my breath for it to become a better language. ( PHP is barely better than 4. They still didn't fix some of the biggest beefs that many people have with the language ). Of course when it is over we'll all be subjected to the Next Big Thing (tm) instead of using something serious for once.

      (and I hope beyond hope the next big thing isn't Ruby on Rails)

    8. Re:PHP now obsolete? by jadavis · · Score: 1

      entirely in Perl cgi, often taking months to do simple tasks

      Huh? I don't think the move from Perl cgi to php will turn months of work into days. The development time is relatively close, even if you ignore all of the templating solutions for perl.

      I understand people have their preferences one way or another, perl, python, php, whatever. But let's not pretend that the mere choice of language can mean the difference between months and days.

      I am more likely to buy it if you're really talking about a big change in the way software is developed, e.g. python instead of C or something.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    9. Re:PHP now obsolete? by WWWWolf · · Score: 1

      PHP isn't obsolete because a lot of people want cheap web hosting, and PHP is what's easily around.

      I personally wish it would be dead in favor of Mason and Rails, but right now PHP is like a swarm of super-powered cockroaches - every damn web host in the planet supports it, and it isn't going away because every damn web host in the planet supports it! PHP is great because of its availability and its simple and powerful syntax, but there's little else to keep its head above the water. And with things like Smarty, it isn't *that* awful to work with.

      Well, my cheap web host gives me SSH account and I could install SBCL. Maybe one day I'll install Rails there too, I've used it on a project and I've liked it a lot.

    10. Re:PHP now obsolete? by lukewarmfusion · · Score: 2, Interesting

      My point wasn't that Perl is the wrong tool for the job. It's just that it isn't always the right tool. That's what this is all about - choosing the right tool for the job.

      Having seen horribly written Perl used in the wrong situation, I know that Perl can take longer to develop than PHP to do some things. Maybe it could have been sped up by using CPAN modules, but the entire application could have been built in a matter of days. The Perl version probably took a month to build, based on the sheer amount of code.

      PHP isn't going anywhere, just like Perl isn't. ASP/.Net are here to stay. I have complaints about all of the above - but they all have their uses, strengths, weaknesses, and an appropriate time to employ them.

      * And after watching the 15 minute demonstration of Ruby on Rails, I'm going to join you in hoping that it isn't the next big thing.

    11. Re:PHP now obsolete? by jadavis · · Score: 1

      PHP is great because of its availability and its simple and powerful syntax

      I haven't heard PHP's syntax described that way before. To me, it seems neither simple (think python, C) nor powerful (think ruby, perl).

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    12. Re:PHP now obsolete? by poot_rootbeer · · Score: 1

      Isn't PHP obsoleted by Ruby On Rails?

      Well, PHP has ten years' worth of installed code out there (some good, some bad, some ugly). Ruby on Rails has the buzz among progressive web developers, but how many job postings are there asking for RoR experience? How many major web sites are built on RoR?

      Not that I think vanilla PHP is a very good solution for anything but rapid prototyping. But add in some extensions like Pear::DB, Smarty, and php.MVC, and PHP becomes not only a reasonably elegant development platform to use, but also one you can make a living working with.

    13. Re:PHP now obsolete? by perly-king-69 · · Score: 1

      Yup. I can't think of a single hosting company that still offers PHP.

      --

      --
      This sig is inoffensive.

    14. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      TROLL!

    15. Re:PHP now obsolete? by WWWWolf · · Score: 1
      I haven't heard PHP's syntax described that way before. To me, it seems neither simple (think python, C) nor powerful (think ruby, perl).

      I have heard it described as such, not that I particularly really, really believe in it. I don't how what makes PHP "simple", apart of the fact that a lot of newbie coders get their toes wet with it and think it was a breeze to learn. I don't know if it's really that powerful, apart of the fact that zillions of zillions of libraries of debatable merit are provided with the stock language. I know PHP isn't really simple (you really need the manual open in web browser to make sense of any particular function's syntax - how_do_you(underscore) functionnames(again) and (parameters, in, order, are, which, today?)... and it's pretty verbose too, not really as powerful and clean as Perl or Ruby, yes.

      But in contrast, I have never heard C being described as a particularly simple language. Usually newbie heads tend to start exploding at the time people start discussing pointers and pointer arithmetic. And I do consider Python to be falsely simple in that it's actually far more complex than it looks. =)

    16. Re:PHP now obsolete? by eyeye · · Score: 1

      Having seen horribly written Perl used in the wrong situation, I know that Perl can take longer to develop than PHP to do some things. Maybe it could have been sped up by using CPAN modules, but the entire application could have been built in a matter of days. The Perl version probably took a month to build, based on the sheer amount of code.

      The entire application probably could have been built in a matter of days using perl too.
      --
      Bush and Blair ate my sig!
    17. Re:PHP now obsolete? by C_Kode · · Score: 2, Interesting

      You are obviously speaking without thinking (or just flat out don't know any better) as PHP also includes the bathroom sink just like Perl + CPAN.

      FYI, PHP is a serious language. If it weren't so many people/companies wouldn't be using it. (and I mean beyond inexperienced users.. Yahoo for a example...)

      btw, I have an intrest in Rudy, my current favorite language to use for admin purposes is Python. Some have claimed that a language cannot speed up the process of development. They have not used Python. I used PHP, bash, and even Perl for those purposes and Python cut the development time in half.

      Thats my experience anyway. When I have time, I will sit down with a Rudy book. Also to note there is no documentation like php.net's documentation. I wish they would open source it, or other languages would mimic the PHP website.

    18. Re:PHP now obsolete? by tootlemonde · · Score: 1

      The article cites a survey from Evans Data Corp. that claims PHP use is declining but the rest of the article doesn't support that conclusion.

      Zend claims the number of monthly downloads of its Zend integrated development environment (IDE) today number 20,000, up from 5,000 in September 2004, with an accompanying 150% growth in the privately held company's revenue. Furthermore, Zend is opening offices worldwide.

      As for stats, Zend points to Netcraft who claims 22m internet domains use PHP, making it the internet's most popular scripting language.

      "Microsoft is interested in PHP - the next version of IIS is going to support PHP. If there was no interest, or we were seeing a decline of interest in PHP, why would they get their product to support PHP?" asked Zend vice president of marketing Michel Gerin.

      Furthermore, while EDC maintains PHP is not seeing "serious" deployment, Zend claims changes to the language like the addition of Object Orientation (OO) in PHP 5.0 mean the language is going beyond pure web site development and into the enterprise as an alternative to Java and C++.

      While adoption may be slowing, PHP is not going away. With an estimated 2.5m PHP developers and web sites going up on a daily basis that have been built using PHP, the language is firmly ensconced in computing's landscape. The only question seems to be: how deep can PHP go in business computing?

      The decision by IBM and Oracle to provide native support for PHP in their databases proves they have recognized PHP's ability to harm their core businesses, and their desire to avert any problems by winning over PHP developers

    19. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      you're not a web developer, are ya. just compare the language features, library code, and install base.

      this will help you determine which is the well-established platform that will be around for years, and which is the hyped new tech with lots of potential.

    20. Re:PHP now obsolete? by jadavis · · Score: 1

      I have never heard C being described as a particularly simple language

      Well, it's simple in that you have a very limited set of data types and operators. Basically, you just have pointers, chars, ints, functions, and structs. And the operators are basically: add, mult, div, mod, subtract, dereference, function call. Everything else is in libraries, standard or otherwise. (This was not meant to be a formal exhaustive list, but a general characterization). So it's a minimalist language. I guess it's debatable whether that's "simple" or not.

      To me, PHP is pretty complex. There are all sorts of implicit type conversions, special characters or sequences of characters that do very particular things like "?>", "<?", "`...`". There are arrays that can be sort of sequential and sort of associative at the same time. You can reset the type of a variable in place with settype, which can truncate a value. Pass-by-reference is entirely decided by the function definition. Errors are often printed directly rather than returning some kind of error code or throwing and exception. There's some really weird stuff too... like using "@" in front of a function call to supress errors from being sent to the output.

      We may not be able to decide what is simple, but how 'bout we agree on what is not simple?

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    21. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      * And after watching the 15 minute demonstration of Ruby on Rails, I'm going to join you in hoping that it isn't the next big thing.

      And this is from a PHP booster...

    22. Re:PHP now obsolete? by Weirdofreak · · Score: 1

      You can't judge a language by how many companies use it. Companies don't have a clue what they're doing; they just think, "hey! PHP is popular right now, I bet it would be easy to find a lot of people who can program it." You judge it by how popular it is with good programmers. People who know multiple languages over the entire spectrum, can pick up new ones in a day or so, and could fairly easily write just about any tool they needed. I admit that I'm not one of these, but I can see that PHP's bathroom sink, if nothing else, has stiffer taps than Perl's. It's designed to be easy to learn, easy to read and easy to think, none of which are conducive to writing real apps in. It's a simple language, intended for simple things; it doesn't give you the micromanagement capabilities needed for some things or the abstractions that make others far easier.

    23. Re:PHP now obsolete? by telbij · · Score: 1

      (and I hope beyond hope the next big thing isn't Ruby on Rails)

      That's the kind of statement that needs to be qualified. Ruby is arguably the best interpretted language out there. Rails is the MVC design pattern plus some nice tools. What's not to like?

    24. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      and I hope beyond hope the next big thing isn't Ruby on Rails

      Too late... There was a huge amount of buzz around RoR at OSCON and everyone I meet who tries it seems to be a convert. It's like the pod-people in Invasion of the Body Snatchers. People who at first criticized Rails now seem to love it. I haven't tried it yet and I'm a bit skeptical, but I'm starting to think that when I try it I'll suddenly love it and become a convert too. Too many smart people seem to be convinced.

    25. Re:PHP now obsolete? by Anonymous Coward · · Score: 0

      There's so many serious errors in the basic design of the PHP (pretty hopeless parser, heh) language itself that no amount of PEAR hand-waving will cover it up. Just as one example (with huge, far-reaching implications): namespaces. PHP doesn't have them, and that's a really, really bad thing for a lot of reasons that you won't understand until you've been programming large systems for at least three or four years. Python at least has a more intelligent base design, but the toolkits and frameworks just aren't there for large systems development (and no, Zope doesn't count). Your php is popular therefor good argument is a sure sign that you're ... inexperienced. ;) If that argument was correct, we'd all be using Windows.

    26. Re:PHP now obsolete? by mcrbids · · Score: 1

      Anyone doing anything more than that on the web has to know something besides PHP since doing anything complex in PHP simply isn't very easy at all.

      Having done some rather large and complex projects with PHP, your comment leaves me very curious.

      What complex thing(s) is/are difficult to do in PHP? (I'll draw the line at stuff like rendering 3D, since the language clearly isn't meant for stuff like that)

      I've had excellent results

      1) Developing semi-distributed, (borrowing a buzzword) RIA type application using PHP-GTK.

      2) Read headers from MP3s

      3) Forked it into a daemon to process TCP socket calls with a home-rolled protocol,

      4) Parsed Apache and Sendmail log files,

      5) Run system administration,

      6) Build a large-scale backup system

      and much more, as well as the usual "I built a weblication using LAMP". I fail to see where PHP is particularly limiting in general programming...

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    27. Re:PHP now obsolete? by Christianfreak · · Score: 1

      I disagree with the assertion that Perl takes months where PHP takes days in anything. I didn't say that the reverse was true. Language shouldn't matter in the hands of a good programmer.

      As for PHP including the bathroom sink, my biggest beef with it is that it does it by default. With Perl I can get just what I need and it stays out of my way, whereis PHP is a monolithic mess.

    28. Re:PHP now obsolete? by Christianfreak · · Score: 1

      Ruby as a language look pretty nice but I have the same problem with RoR as I do with PHP. It tries to do too much for you. Its probably great for specific things but a mess when someone needs finer control.

      To be fair I've not used it in production. Hopefully its better than what I've played with/seen in the demo.

    29. Re:PHP now obsolete? by telbij · · Score: 1

      Ruby as a language look pretty nice but I have the same problem with RoR as I do with PHP. It tries to do too much for you. Its probably great for specific things but a mess when someone needs finer control.

      If you're referring to register_globals and magic_quotes_gpc then I must say that those are the least annoying of PHP's issues when you are developing for a single environment. PHP is an adequate language, but it's filled with questionable design decisions and legacy functionality that just adds up to a lot of unpleasant edge cases and quirky behaviour.

      RoR on the other hand is just a framework, most of the things it does are entirely optional. If you don't need an MVC design pattern then of course RoR is pointless, but I don't see it cramming things down your throat like PHP does. You can use it as a pretty minimalistic MVC template with all your own Ruby functionality.

      That said, having been developing web applications fulltime for 6 years in PHP and Perl, I gotta say that RoR makes a lot of sense out of the box. The things it does are by and large the things that I'm sick of doing after writing the 100th web application. Unlike other frameworks I've seen, it has a strong eye towards standards and clean HTML, and you just can't beat Ruby as a templating language.

  5. PHP is good but.... by jbdodson · · Score: 1, Insightful

    I am not sure the addition of more OOP support is going to take PHP into the "less hackish" language camp in my mind. Moving from PHP development to a Java or Python/Zope based model with more emphasis on MVC patterns and Unit testing, is much better than the old hack way of putting all the controler, model and view code on the same page. I guess for a quick and easy solution, PHP got your back, I am not really in love with how it scales up if you want to move into MVC though. Plus the fact that it is a functional language at its core is not too appealing from a OOP perspective. Though, I use it to program my blog, go figure.

    1. Re:PHP is good but.... by bobbyjack · · Score: 2, Insightful

      "Plus the fact that it is a functional language at its core is not too appealing from a OOP perspective. Though, I use it to program my blog, go figure."

      I figure that OOP is not the magic bullet many proclaim it to be. That some tasks fit the OOP model very well and others fit the functional model very well. And that PHP is a good language for certain applications, such as your blog.

    2. Re:PHP is good but.... by Anonymous Coward · · Score: 0
      I figure that OOP is not the magic bullet many proclaim it to be.

      In other words: "OOP is POOP!"

    3. Re:PHP is good but.... by Anonymous Coward · · Score: 1, Insightful

      PHP isn't functional, btw. It's procedural.

    4. Re:PHP is good but.... by Bogtha · · Score: 2, Insightful

      the fact that it is a functional language at its core is not too appealing

      PHP isn't a functional language. It's a procedural/imperative language.

      I figure that OOP is not the magic bullet many proclaim it to be.

      Who has proclaimed OOP to be a magic bullet? Less of the straw men, please. I can't remember ever hearing anybody claim anything was a magic bullet seriously.

      --
      Bogtha Bogtha Bogtha
    5. Re:PHP is good but.... by Anonymous Coward · · Score: 0
      "Though, I use it to program my blog, go figure."

      Your blog is fucking shit, go figure THAT, fucktard.

  6. The point? by op12 · · Score: 1

    It sounds like one of many tutorials that are readily available on the internet. I find it much easier to learn by example, but even those that prefer this method can find a tutorial to suit their needs. Actually coding is the only way to really learn the language and its nuances anyways. It seems like a book would be pointless given the vast amount of information available online, and the speed with which the latest information (as new versions are released) could appear online versus in a book.

    1. Re:The point? by op12 · · Score: 1

      And of course I neglected to mention for (approximately) the same information:

      Learning online $0
      Using the book: $30

  7. To buy or not to buy, the reviewer doesn't know! by garcia · · Score: 1, Troll

    This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

    So, even though most people use PHP + MySQL and books of the type have been popular this one doesn't do that.

    Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP).

    But yet it does explain MySQL? Which is it? I'm not going to buy the book if the reviewer can't figure it out.

    The publisher's Web site for the book does not appear to have any collection of errata.

    It has errors that a reviewer found (but can't determine if it supports MySQL or not) and no corrections for them. Chalk another point up.

    Aside from the errata, there were some other weaknesses -- none of them serious: The chapter summaries are useless.

    I don't like to read through everything (I'm not looking for errors to review about) so I'd like a decent summary.

    Combining them makes no sense, and the author does not even transition from the first topic to the second.

    Mmm, makes me want to run out and buy the book. Bad writing on top of errors and poor teaching. Sounds like a great way to Spring into PHP 5 doesn't it?

    Like others in the "Spring Into" series, this title is reasonably priced, at only $29.99 list for over 300 pages of quality material.

    From what I have read here it's not much quality. So which is it? MySQL or not, quality or not?

    For those looking to spring into Web server-side development in general, or PHP in particular, it would be money well spent.

    I'll stick to learning from sample code. It's cheaper, better written, and probably easier.

  8. A smarter approach? Learn the idioms and toolkits by joelparker · · Score: 2, Insightful
    >A smarter approach is to learn the language basics in sequence as rapidly as possible

    In my experience a language becomes useful when you also learn the frequent idioms and know the available toolkits.

  9. professionals by Eric604 · · Score: 0, Flamebait

    professional don't need to learn php because it's asp.net everywhere.

  10. Bogged down by sample code?? by mabu · · Score: 4, Insightful

    A smarter approach is to learn the language basics in sequence as rapidly as possible, not getting bogged down in excessive sample code.

    Excuse me? Maybe I'm an anomoly, but I can't think of a better way to learn a language than by example. This suspiciously sounds like and excuse to cover up the fact that the book doesn't offer adequate material to show how one can code in real-world environments.

    When I look for a good programming book, be it an introduction, advanced tutorial or reference, the use of lots of examples is one of the main standards by which I judge the value of the publication.

    1. Re:Bogged down by sample code?? by raftpeople · · Score: 1

      I completely agree. I am constantly learning new languages quickly through example. Google is my teacher.

    2. Re:Bogged down by sample code?? by Dakrin1 · · Score: 1

      The reviewer is not talking about not learning through sample code. It's talking about EXCESSIVE sample code. The review states (in the first paragraph no less):

      "The bulk of the explanation takes the form of code samples, which fortunately are short enough in length and clear enough in composition to be easily digestible. This is in stark contrast to far too many other programming books on the market, whose code samples can span multiple pages, making it difficult for the reader to discern all of the ideas that the author is trying to get across"

    3. Re:Bogged down by sample code?? by Eric604 · · Score: 2, Insightful
      yeah but too much isn't good either. The last thing you want is crawling through pages of example code while it can be explained just as well in only a few lines.

    4. Re:Bogged down by sample code?? by zx75 · · Score: 2, Funny

      I don't know... I rather enjoy learning by counter-example.

      Though I imagine for a beginner those nasty regexs of invalid code could bog you down a bit...

      --
      This is not a sig.
    5. Re:Bogged down by sample code?? by theantipop · · Score: 1

      I agree fully here. I had to learn PHP a couple weeks ago for a new web app. Coming from using PL/Sql and knowing a bit of Perl, PHP was a breeze to pick up based on sample code alone. I already knew the basics as far as how the language works, I just needed a list of syntax and built in functions relating specifically to what I was doing. To me, hyperlinking through Google searches is more efficient for someone with a programming background than skimming linearly through beginner fluff to find what you need.

    6. Re:Bogged down by sample code?? by Eric604 · · Score: 2, Informative

      If you only need syntax and buildin functions, wouldn't it be faster to look it up in the references/manuals on the php site? As an experienced programmer you only need the specs of each function/syntax. Example code shows only how to connect the dots in one particular way but that knowledge is very limited when you don't know the full specs. I find a clearly written reference way more usefull than a handfull of examples and if I recall correctly, the php site has some good documentation online.

    7. Re:Bogged down by sample code?? by Anonymous Coward · · Score: 1, Insightful

      It depends on what you want to learn. If you just need to quickly hack something then examples are great, but without learning the core of a language you you'll be limited to only being able to do the basic things seen in examples, and will have a hard time doing something novel. And without knowing the language you cannot judge the quality of the example you are copying.

    8. Re:Bogged down by sample code?? by mabu · · Score: 1

      Can you imagine trying to learn regular expressions without sample code? Yea, it can be done, but like many areas of programming, examples can demonstrate subtle nuances that are not obvious in mere references.

  11. MOD PARENT UP by Anonymous Coward · · Score: 0

    I hate it if a client is not willing to switch to a sane host and uses the el-cheapo-WalMart-PHP-only-shitshop his 13 year old daughter selected for him.

    1. Re:MOD PARENT UP by Anonymous Coward · · Score: 0

      Why, exactly? I'm sure we're all dying to know.

    2. Re:MOD PARENT UP by Anonymous Coward · · Score: 0

      Hey leave my client's 13 year old daughter out of this, you dirty old man.

  12. PHP vs Ruby On Rails by CatGrep · · Score: 1, Interesting

    I'd like to see more comparisons between the two. At this point, it seems to me that if one were just starting out in web programming they might be better off going with Ruby On Rails. I don't see any advantages for PHP now.

    1. Re:PHP vs Ruby On Rails by Anonymous Coward · · Score: 2, Informative

      Hmm lets see, time to compare a Web programming language vs a Framework.

      Now you could compare Ruby to PHP or Rails to an mvc PHP framework like Cake.

      But PHP against Ruby on Rails is Apples vs Oranges.

    2. Re:PHP vs Ruby On Rails by Heisenbug · · Score: 1

      I haven't used Ruby, but here's the advantages I can think of for PHP. How does Ruby stack up?

      1) PHP is the most common. I don't care what the Slashdot summary says, I like being able to find code snippets that have already solved the problem I have.

      2) Corollary, PHP runs everywhere. Whatever the hell webhost the client went with, it probably already has PHP installed.

      3) PHP is blindingly simple. If you're coming into web programming from desktop programming, you already speak C, and PHP is like C with anything remotely complicated taken out.

      Like I said, I'm in no position to say PHP wins on any of those points -- are they still true?

    3. Re:PHP vs Ruby On Rails by jadavis · · Score: 1


      PHP is blindingly simple. If you're coming into web programming from desktop programming, you already speak C, and PHP is like C with anything remotely complicated taken out.


      "@" is a special character in PHP, used before a function call, to supress errors from being directly printed. That is about as un-simple as you can get in my opinion. There are all sorts of strange, inconsistent, or overly-specific aspects to the language. PHP is not even remotely like C, except for the { }.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
  13. better idea for a book by cptbarkey · · Score: 1

    something more useful would be a book teaching people effective ways of ripping other peoples source code, i very rarely if ever write original source.

  14. I don't even know where to begin... by Anonymous Coward · · Score: 0

    Ruby On Rails, popular as it is with the fanboy set, is not a replacement for every web application framework in existence. Also, PHP is (ostensibly) a language and Ruby On Rails is a framework. Stupid comparison. You might as well ask if Ruby On Rails obsoletes bagel slicers.

    PHP was obsolete the day it was born. It wasn't designed, it just happened, and it really shows. I can't fathom why anyone would want to do serious work in it. No, your little weblog package is not serious work.

    By the way, you're a little behind on the latest thing to cheer for. I think we're all fapping over Django now, since it's built on what is in my opinion a more sophisticated language.

    1. Re:I don't even know where to begin... by Guido+von+Guido · · Score: 1
      Python is more sophisticated than python? Gotta say I don't see it--although I think they're pretty similar (in terms of sophistication, anyway).

      Or do you mean that python is more sophisticated than PHP? Just pretend I never said anything.

    2. Re:I don't even know where to begin... by sjaskow · · Score: 1

      Well, I know for a fact that this is a serious work built on PHP.

      As long as you understand the limitations of PHP, it can be a very powerful language.

      And Python is the stupidest language ever, white space as block delimiters? What happens when you cut and past from one windows that has tabs into another where the editor doesn't understand them?

    3. Re:I don't even know where to begin... by jadavis · · Score: 1

      stupidest language ever, white space as block delimiters?

      Everyone always says that, and to a certain extent it's true.

      However, everyone I know who's actually tried it, including myself, is surprised at how often what they write does what they expect the first time.

      It was really amazing. And in practice, usually editors handle the whitespace quite nicely. Python may not be right for every task, but it's been a wonderful tool to have available.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    4. Re:I don't even know where to begin... by Mr.+Underbridge · · Score: 1
      And Python is the stupidest language ever, white space as block delimiters? What happens when you cut and past from one windows that has tabs into another where the editor doesn't understand them?

      Oh, it screws it up royally. And don't get me started on linefeeds between windows and unix. And the whole "lambda" function concept...actually, I'm going to have to fight you. I think that's dumber than the whitespace thing, and that's saying something.

      Other than that, though, python has some advantages as a deployable rapid development language. It has a ton of support for math and science applications, including an easy interface for precompiled LAPACK binaries and such. You can code very quickly, the code is very readable, and if you've done a good job and avoided loops as much as possible, the code runs fast too.

      Basically, you can code in Python almost as fast as you can code in something like Matlab, with the difference being that it's much more portable since python is a more accepted standard and doesn't cost thousands of dollars a seat.

    5. Re:I don't even know where to begin... by databyss · · Score: 1

      "However, everyone I know who's actually tried it, including myself, is surprised at how often what they write does what they expect the first time."

      How does this have anything to do with the language?

      I don't find very many instances where the code I write does something unexpected, or am I mistaken and you are talking about buying pythons that write code?

      --
      Hmmm witty sig or funny sig? Maybe elitest techy sig!
    6. Re:I don't even know where to begin... by arkanes · · Score: 1

      Python actually correctly handles linefeed differences, and as long as you don't *mix* tabs and spaces in a file, it will execute correctly whether your editor understands tabs or not. On the other hand, if you're actually writing code, in the year 2005, in an editor that doesn't understand tabs you're a fuckup anyway.

    7. Re:I don't even know where to begin... by Guido+von+Guido · · Score: 1

      Eh, I hate the white space thing myself, but if you can't get over it in 20 minutes or working with python you've got more serious problems.

    8. Re:I don't even know where to begin... by jadavis · · Score: 1

      The python language somehow seems to be less bug-prone than other languages. I find more of my time is used to write code, and less time is used to test and debug during the development process.

      Of course, YMMV. I recommend to anyone interested in trying a new language that they give python a chance, and suspend their disbelief of the whitespace-is-significant syntax.

      Everyone I've known that's tried using python for a fitting task has been impressed with the ease of development.

      That being said, it's not the perfect language. I was just mentioning that it has a certain magical quality to the syntax where people seem less likely to make mistakes the first time through. That's a great quality when making unix administrative scripts or glue code.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    9. Re:I don't even know where to begin... by Mr.+Underbridge · · Score: 1
      Python actually correctly handles linefeed differences, and as long as you don't *mix* tabs and spaces in a file, it will execute correctly whether your editor understands tabs or not. On the other hand, if you're actually writing code, in the year 2005, in an editor that doesn't understand tabs you're a fuckup anyway.

      If you're working in an interpreter and copy/pasting from a script, the interpreter (at least those I used) would generally screw up the linefeeds when I'd try to copy part of the script and dump it in the interpreter window. Particularly if you actually used whitespace in your code, loops didn't work right when I tried to do that. This has been a few years, perhaps the interpreters are better now. And no, that isn't directly a core language issue, but treating whitespace as an integral part of the language like that sets you up for such problems.

      The whitespace-as-code concept really just causes more problems than it solves. Use an auto-intenting editor - if you're programming in 2005 without one of *those* you're also a screwup.

    10. Re:I don't even know where to begin... by arkanes · · Score: 1
      "If you're working in an interpreter and copy/pasting from a script, the interpreter (at least those I used) would generally screw up the linefeeds when I'd try to copy part of the script and dump it in the interpreter window."

      This is your shell screwing up, not the python interperter. It has nothing to do with the language at all.

      And while your experience may vary, I find that the whitespace blocks cause no problems, and all my Python code is more readable than my C or C++ code. Go figure.

    11. Re:I don't even know where to begin... by Hognoxious · · Score: 1
      This is your shell screwing up, not the python interperter. It has nothing to do with the language at all.
      Well, apart from the fact that if the language didn't see whitespace as significant then it wouldn't matter, you're totally right.
      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    12. Re:I don't even know where to begin... by Bitsy+Boffin · · Score: 1

      I seem to recall even Guido saying that in hindsight the whitespace delimiting was a bad idea.

      I agree, sure it might seem a nice way to enforce nice code style, but in reality it's a pain.

      I'd like to see python with traditional ( { ... } ) block styles for three reasons, one is that it's easier to mix tab & space as I am prone to do, two is that it makes code folding easier for editors, and three it would pave the way for embedding python in html for web work (eg ) where there is no way to cleanly keep block indentation.

      --
      NZ Electronics Enthusiasts: Check out my Trade Me Listings
  15. just great, by ag-gvts-inc · · Score: 1

    I haven't read my php4 book yet

  16. From the Incredibly Obvious Dept... by ThePepe · · Score: 1

    From the Incredibly Obvious Dept

    Learning a programming language is better than doing it half-assed.

    Stay tuned for tomorrow's topic, 'Computers are easier to use if you know how to use them'

    1. Re:From the Incredibly Obvious Dept... by Christianfreak · · Score: 1

      Learning a programming language is better than doing it half-assed.

      If that's the case why aren't people out learning real programming languages instead of messing with PHP?

      (yes you may mark it flamebait now)

  17. PHP 5 is trash by Anonymous Coward · · Score: 1, Informative

    I did some memory profiling on some new PHP5 code I'm working on. The test code only defines classes and no object code is actually executed in these tests. All it does is call require(), no business logic is run. This is the average memory consumption of the script for ten runs on PHP 5.0.4 with various optcode accelerators:

    No accelerator: 1,746,752 bytes
    eAccelerator: 782,576 bytes
    APC: 772,200 bytes
    Zend Platform: 333,856 bytes

    Apparently the opensource accelerators just don't optimize PHP5's new object syntax much, if at all. Without any acceleration, the god damn script without any business logic uses more memory than the interpreter footprint!

    For comparison, here are the same stats for phpMyAdmin 2.6.2-pl1 on this system:

    No accelerator: 2,079,744 bytes
    eAccelerator: 337,392 bytes
    APC: 338,416 bytes
    Zend Platform: 391,992 bytes

    Notice the opensource accelerators come closer to Zend here. I think this is because phpMyAdmin is not written in the new PHP5 object syntax and uses the old syntax instead.

    Basically Zend has made it so PHP limps along like a trash can unless you shell out $1500 per server. It would cost us over $15,000 to use Zend Platform, but without it we can't really move off of PHP4.

    1. Re:PHP 5 is trash by Just+Some+Guy · · Score: 1
      This is the average memory consumption [...] 1,746,752 bytes

      Let me be the first to say that your benchmarking methodology sucks. Does that 1.7MB of RAM consist of 1.6MB of constant overhead + .1MB of script usage? Who knows - you certainly don't seem to have bothered to test it. Does eAccelerator use the extra memory for results caching that result in higher throughput and overall lower resource usage? Again, you don't seem to have gotten past "it's teh bloat" so we have no way to venture a guess based on your numbers.

      Frankly, if you measure performance in terms of "module A uses 770KB of RAM, but module B only uses 320KB", then PHP is clearly the wrong language for you. I don't particularly like PHP, either, but your "reasons" certainly would not have convinced me if I felt otherwise.

      --
      Dewey, what part of this looks like authorities should be involved?
  18. Pretty Home Pages by Mateo_LeFou · · Score: 2, Informative
    I remember this book ... it was terrible. It contained NOTHING specific to PHP5's features. Also it was terrible. It was full of
    echo "TD> blah blah blah /td>";
    echo "TD> and so on /td>";
    echo "/TR";
    echo "/TABLE";

    ick.
    And I remember somewhere it said PHP stands for "Pretty Home Pages"
    wtf indeed.

    --
    My turnips listen for the soft cry of your love
    1. Re:Pretty Home Pages by jacksonj04 · · Score: 1

      PHP stands for "PHP: Hypertext Preprocessor". Long live recursive acronyms.

      It used to stand for "Personal Home Page".

      --
      How many people can read hex if only you and dead people can read hex?
    2. Re:Pretty Home Pages by DrMowinckel · · Score: 1, Informative

      Well Actually it used to be called "Personal Homepage Parser" - Just to clear things up. And we knew it wouldn't hold. It's just not recursive enough. And all names has to be recursive, like

      Now if Bill had named his operating system "WINDOWS Is Not the Devil's Own Work, Sandy". It would have been a lot better.

      --
      In soviet Russia, Raymond loves Everybody, including, but not limited to, YOU!
    3. Re:Pretty Home Pages by Anonymous Coward · · Score: 0

      We Interestingly Now Deem Our WINDOWS Sucks

  19. Re:To buy or not to buy, the reviewer doesn't know by Dakrin1 · · Score: 2, Interesting

    If the reviewer is really that confused, it might not be a good idea to take any of the points he makes too seroiusly.

  20. Re:Posting anon to protect the guilty by bobbyjack · · Score: 2, Insightful

    "First, it has no mechanisms to enforce any kind of good web application design practices."

    Can you name me a language that DOES have "mechanisms to enforce any kind of good web application design practices"? I'm not sure I can think of anything built into a language (i.e. not just an add-on library which, of course, PHP could provide) that does do this.

    "Almost invariably, PHP apps are initially designed by people who are newcomers to programming and the web."

    I've seen many state this and have suspected it myself, but have never come across any good statistical proof. Can you post your reference?

    "But PHP doesn't provide any structure to help them make the right decisions,"

    Can you give an example of this? I'd be interested to see a language feature of [insert other language here] that "helps [newcomers] make the right decision".

    "so you end up with no separation between HTML and code, and you end up with an unmaintainable mess."

    But what's to stop this from happening in ANY language? And what's to stop it NOT happening in PHP?

    "Second, it's not a full-featured object-oriented programming environment like Java."

    I'll give the you benefit of the doubt, here, and assume you missed that oh-so-important comma. However, I'd argue that "not object oriented" is not a fundamental flaw of a language. Say we only had OO languages RIGHT NOW. Do you think everything would run quite as smoothly?

    "In Java, I can create objects, store them in sessions, hand them to threads, and store them using persistence frameworks. PHP has only the most rudimentary versions of such features."

    Good for you. What are the advantages of doing what you're doing that obsolete PHP in every instance?

    "Within a Servlet environment I can also create filters, something which doesn't exist in PHP."

    Please explain more - I don't know what filters are. I'd be very surprised if PHP could not support whatever-they-are.

    "There is hope. There are some tools like Smarty Templates and PEAR which help a little bit. In fact if beginners would force themselves to use Smarty Templates from the beginning they would get much better results."

    I'll have to get back to you on Smarty.

    "PHP doesn't have strong typing on variables, something which should be a part of any system that needs to be reliable."

    WHY? How strong is the typing in the language used to write the OS you're running right now?

    "There's no complition of PHP systems, which means that the only bugs are run-time bugs."

    Why is a smaller number of classes of bugs inherently a bad thing? Or is that just an objective statement?

    "PHP just isn't a good choice."

    For what? Why? I'm still not sure I quite understand.

  21. i've gotta say.... by rwven · · Score: 1

    ....php was, for me, the easiest language to pick up. There's a plethora of built in functions to help you do just about anything and the syntax is like a hodgepodge of other languages best points put together. Maybe not everyone feels this way, but it's definatley in my top 5 favorite languages to write in. The only book(s) i think any programmer needs to pick up PHP are the visual quickstart guides from peachpit press. (shameless plug i'm afraid, but i love their stuff.)

    1. Re:i've gotta say.... by nocomment · · Score: 2, Interesting

      I second this. I've done PERL BASH, a couple crappy C, yadda yadda. and I was able to pick PHP in an afternoon. Especially with it's similar structure to PERL.

      I use php for most everything now, especially since php-cli came out. I even write my shell scripts in it now.

      A few weeks ago I had to write a site that would allow users to input obituaries (I work in newspapers) and send off an XML feed and any binary images to an FTP server. The cool part is that the SAME script can be run from a command line or a web browser. Need the (l)users to input the obits? give them the website. If they need to send off a feed immediately (say for instance there is a typo on the website) it's a 1 click option for them. The script creates thubnails in png format from jsut about format you can think of. They can upload EPS, PNG, JPG, GIF, TIFF, BMP, or even a PDF, or anything else support by imagemagick

      Need to purge the database? run ./index.php --purge (this is also in a cron), need to troubleshoot an XML file? run ./index.php --xml to create a new file. Sending off a new feed from the command line? ./index.php --xml --ftp.

      The users love it because they can edit the obits in real time on the website, removing extra line breaks changing the photo or whatever else they need to do with a live preview.

      Time to build it? roughly 4 hours and that includes setting up the PostgreSQL database.

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
    2. Re:i've gotta say.... by rwven · · Score: 1

      nice. I also used to write all my shell scripts in PHP as well. I changes jobs to more of a data-mining position so i dont do it anymore, but it was incredibly useful. I did all sorts of string manipulation and stuff as well. One of my favorite things was using the functions that would open a file as an array of strings. One element for every line in the file. It makes flat file information storage a snap... I wrote a script that would open snort logs and sort through them for things of interest, decide what was worth keeping (snort gets a lot of predictable false alarms), save it to a file, e-mail the file to me, then archive the log/email files for that day. Every time the month changed it would then archive the months worth of snort detections into its own archive directory. ridiculously powerful...

  22. About to migrate... any tips? by markmcb · · Score: 1

    I'm about to migrate a site I administer, OmniNerd, to PHP5 from PHP4. Any areas of focus from those of you who have already done it? I do a lot of XSLT translations and I've noticed that I'm going to have to recode of xslt_process() calls. Any other major changes I should be looking for?

    --
    Mark A. McBride -- OmniNerd.com
    1. Re:About to migrate... any tips? by Limburgher · · Score: 1

      Watch for array_merge calls. It's a lot pickier now about what it will accept. Be sure to look here for the whole story, but I found that in the process of tidying up my code to accommodate the change, I refactored several sections of code to avoid the need for array_merge entirely. Hint: Do absolutely everything you can in SQL instead of in your code. This goes for any language. The performance boost will be noticed both on old hardware and on high-load installations.

      --

      You are not the customer.

  23. yeh, seems kinda trollish by Mateo_LeFou · · Score: 1
    I'd like there to be an open source web stack that compares to J2EE and .NET

    It's fine with me if that eventually is RoR, but considering the much vaster PHP user base, wouldn't P5 be a better starting point?

    --
    My turnips listen for the soft cry of your love
    1. Re:yeh, seems kinda trollish by WWWWolf · · Score: 1
      It's fine with me if that eventually is RoR, but considering the much vaster PHP user base, wouldn't P5 be a better starting point?

      Perl 5? We're talking of object-oriented, MVC-heavy thing here. Try doing object-oriented programming in Perl 5 for more than 10 seconds and you may notice it's not really that bright idea. Breeze to instantiate a class and use it, but as for implementing it, ugh...

      Perl 6 of tomorrowyear has a very nice and clean object interface, kind of like Ruby is now, actually...

      That said, Perl *does* have a really nice MVC framework out there. It's called Maypole, and would absolutely kill RoR dead if Perl's object syntax weren't so horrenduous and it wouldn't need million and one weird CPAN modules to run. I haven't used it much, but it seems like it has RoR's scaffolding features on steroids...

    2. Re:yeh, seems kinda trollish by Mateo_LeFou · · Score: 1

      >Perl 5? Um ... no, PHP5 ... as per TFA. Guess P5 is one of my own personal shorthands (Presently hacking a PHP5 version of Maypole as it turns out)

      --
      My turnips listen for the soft cry of your love
    3. Re:yeh, seems kinda trollish by WWWWolf · · Score: 1
      Um ... no, PHP5 ... as per TFA.

      Ah, sorry for my coffeed rambling. Me, on the other hand,
      1) have only heard "P5" used to mean Perl 5 and Intel's codename for Pentium, and
      2) don't see the point of abbreviating already abbreviated things. =)

  24. Proposal for new Slashdot topic/section: by DogDude · · Score: 1

    PHP book reviews! Considering that there seems to be about 1-2 week, it would be a pretty good size topic.

    --
    I don't respond to AC's.
    1. Re:Proposal for new Slashdot topic/section: by kv9 · · Score: 1

      i dont know which alternate-weirdland-slashdot you read, but here, in this dimension the last php book was on Jun30. and before that Mar23. id hardly call that a `pretty good size topic'. maybe you should go back to trolling the google threads, as you probably think they are a `pretty good size' too. but what can you do, google has already got a topic.

  25. PHP's effect on Linux's reputation. by CyricZ · · Score: 2, Interesting

    There was some discussion here at Slashdot a few days ago in another topic regarding the effect PHP is having on the reputation of Linux. Considering that it is often grouped with Linux in the LAMP model, and is also one of the more well-known open source projects, there has become a close assocation between the two in the eyes of the general public.

    Now it's no secret that PHP has suffered from some pretty serious security issues as of late, such as the XML-RPC flaw. Then there are the routine problems of poorly developed blog and CMS systems being defaced. Many of these problems are attributed to inexperienced users writing what amounts to completely horrible code.

    While the developers of PHP itself are very talented and quite respected, the users of PHP are starting to cause problems for the Linux community as a whole. Each time a site is defaced due to some poorly written PHP script, it is often portrayed as a vulnerability with Linux itself. Of course that is more often than not a complete falsity, as the fault does not lie in any way with the Linux kernel or its developers.

    So while Linux advocates often promote the use of PHP for developing webapps on Linux, PHP is starting to become more of a liability. Every site running Linux and PHP that gets defaced due to terribly written PHP scripts reflects very poorly on Linux's public image. Now I have to ask: what is the Linux community willing to do about this problem?

    Would they even be willing to go so far as to demand that the PHP developers include functionality to severely limit the ability of faulty scripts to run? It's quite difficult to say at this point. But if changes aren't made fairly soon, then things could degrade very quickly.

    --
    Cyric Zndovzny at your service.
    1. Re:PHP's effect on Linux's reputation. by Anonymous Coward · · Score: 0

      So? How many vulnerabilities are in C code? Perhaps we should think about something else, since C is obviously dragging down the reputation.

    2. Re:PHP's effect on Linux's reputation. by CyricZ · · Score: 1

      Indeed, C code can often be quite vulnerable. But it isn't often touted publically (ie. to managers, the general public, etc.) as a main reason to migrate to Linux.

      Linux advocates often suggest that Linux is a very secure server platform. Indeed, Linux itself often is. But such advocates often advocate the use of a language like PHP for web development. Each time a well-publicized PHP flaw or script is exploited, it tarnishes the reputation of Linux due to the close association between the two.

      So what is in actuality a shitty PHP script being exploited is misunderstood by managers and other often non-technical users as being a flaw in Linux itself. That is where the problem lies. While PHP was once instrumental in bringing people to Linux, it is now also a leading cause of disrepute for the Linux community as a whole.

      --
      Cyric Zndovzny at your service.
    3. Re:PHP's effect on Linux's reputation. by seek31337 · · Score: 3, Insightful

      This is the most rediculously stupid comment I have ever seen. It makes a series of statements as fact, without any proof.

      It also makes claims of a solution which is incomplete. WTF? 'Would they even be willing to go so far as to demand that the PHP developers include functionality to severely limit the ability of faulty scripts to run?'

      Demand to make C programs unable to be hacked.
      Demand that perl programs are unable to be hacked.
      Demand that assembly programs are unable to be hacked.

      How about looking at the reputation of the group developing the software you morons install? If there's been tens or hundreds of vulnerabilities in the product you want to install, expect more!

      Also, see See http://us2.php.net/features.safe-mode

      --
      No SIG for you!
    4. Re:PHP's effect on Linux's reputation. by quasi_steller · · Score: 2, Funny

      So while Linux advocates often promote the use of PHP for developing webapps on Linux, PHP is starting to become more of a liability. Every site running Linux and PHP that gets defaced due to terribly written PHP scripts reflects very poorly on Linux's public image. Now I have to ask: what is the Linux community willing to do about this problem?

      I know! Linux advocates should promote the use of PHP for developing webapps on Windows!

      --
      ...interesting if true.
    5. Re:PHP's effect on Linux's reputation. by maelstrom · · Score: 3, Insightful

      The solution is to enable SELinux for Apache and only allow those PHP scripts access to their own files. Then even if there is an exploit for the poor written PHP code, the amount of damage it can do will be minimal.

      --
      The more you know, the less you understand.
    6. Re:PHP's effect on Linux's reputation. by Bogtha · · Score: 1

      So while Linux advocates often promote the use of PHP for developing webapps on Linux, PHP is starting to become more of a liability.

      It's not PHP applications that's the problem. It's the people who think that PHP application problems == Linux problems that are the problem. The solution (from the Linux point of view) isn't to fix PHP applications, it's to educate the people making this dumb assumption.

      You've made the same assumption by thinking PHP application security problems are PHP security problems.

      --
      Bogtha Bogtha Bogtha
    7. Re:PHP's effect on Linux's reputation. by CyricZ · · Score: 1

      Indeed, I'd welcome any effort to improve the security of languages such as C, Perl and assembly. Such efforts have been made (ie. Cyclone in the case of C).

      One part of this issue is that PHP's main use is in a hostile environment (the World Wide Web). That's a well known fact. But the truth of the matter is that it just doesn't live up to the security necessary for operating in such an environment. That is a flaw with PHP itself. Worse off, due to various social reasons, PHP is often associated with Linux by non-technical users. So when a PHP script (not even PHP itself) misbehaves and is exploited, it tains the image of Linux quite badly.

      It's no secret that many of the users of PHP are amateurs. That is why the PHP crew needs to get their act together, and develop features into PHP to limit the damage that can be done by exploited scripts.

      Just as companies like AMD and Intel are starting to implement measures in their CPUs to prevent the execution of code after a stack overflow, it is time for the PHP developers to start doing the same. Not just for the sake of providing a secure, quality product, but also for the sake of the reputation of Linux.

      --
      Cyric Zndovzny at your service.
    8. Re:PHP's effect on Linux's reputation. by NardofDoom · · Score: 2, Funny

      I've developed PHP webapps on windows and I have this advice: Don't.

      --
      You have two hands and one brain, so always code twice as much as you think!
    9. Re:PHP's effect on Linux's reputation. by Krach42 · · Score: 1

      poorly written PHP code.

      Seriously, you should be respecting the Adverb and using it properly.

      --

      I am unamerican, and proud of it!
  26. Do we need another entry level book? by scottsk · · Score: 3, Insightful

    I am not knocking this book by any means. It is probably very good. But can't any developer who knows a C-ish syntax language pick up PHP basics quickly? I learned it in a day or two just by analogy with C/Perl/etc. How much need/demand is there for entry level books like this?

    Where computer books have value to me is when they teach me something that would take hours/days/weeks to learn by trial-and-error. Something non-trivial that can't be guessed from reading the doc. (Like setting up user authentication or something.) That's when I start thinking about spending cash on books which have value by saving me time and especially frustration. (The PHP Cookbook, for example.)

    1. Re:Do we need another entry level book? by wilsoniya · · Score: 1

      Agreed. That being said, PHP can be a very good primer language for newbie programmers. There's no graphics API to learn to be able to produce results, and it is extremely well documented. PHP is also a great way for noobs to get into MySQL and DB's as a whole.

      I recommend "PHP and MySQL Web Development" by Luke Welling and Laura Thomson.

      --
      I can't remember the last time I forgot anything.
  27. Re:Posting anon to protect the guilty by Dare+nMc · · Score: 1

    > PHP doesn't provide any structure to help them make the right decisions

    I agree I haven't found the equivilent of Lint for PHP, that would solve all your complaints about PHP as a lanuage.

    the language a person uses will not make a good programmer bad. And no amount of structured language will make a bad programmer write good programs.

    I haven't found a single language, especially not java that does what you claim, their are many many tools for java, and C/C++, etc that do that. And even some of that functionality exists in the popular compilers.

  28. Re:To buy or not to buy, the reviewer doesn't know by Idealius · · Score: 1

    Reviewer: "Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP)."

    Parent post: "But yet it does explain MySQL? Which is it? I'm not going to buy the book if the reviewer can't figure it out."

    The reviewer is saying the book explains how to use PHP with the database program MySQL, but not with other database programs such as Lotus Notes or Oracle.

  29. Re:To buy or not to buy, the reviewer doesn't know by garcia · · Score: 1

    If the reviewer is really that confused, it might not be a good idea to take any of the points he makes too seroiusly.

    Are you inferring that the reviewer thought the book was a joke and that I should assume that from what he wrote?

    I took a look at the header above his confused review and saw that he rated it an 8 (I assume out of 10). If you are really inferring that I shouldn't take his review "seriously" and that I should instead assume he was joking around about the book perhaps he should have rated it differently?

    author: Steven Holzner
    pages: 340
    publisher: Addison-Wesley
    rating: 8
    reviewer: Michael J. Ross
    ISBN: 0131498622
    summary: A comprehensive and no-nonsense primer on the basics of PHP

    If I misinterpreted your statement perhaps I shouldn't pay any attention at all to reviews?

  30. Re:To buy or not to buy, the reviewer doesn't know by garcia · · Score: 1

    Read the first line of my post:

    This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

    So, if it's not meant to be a PHP + MySQL book and it's not showing the other options what exactly is the book doing? The reviewer doesn't know.

    Thanks for proving my point.

  31. Have you even tried python? by Anonymous Coward · · Score: 0
    From Python whitespace FAQ, or, Python is not Fortran 77:
    Should I dislike Python's significant whitespace?

    No, you shouldn't.

    Why not?

    Because it's the most natural thing, and, while it's a lovable feature of Python, it's not that big a deal anyhow. It shouldn't be a show-stopper.

    But it's ugly and wrong.

    No, it's not. It's beautiful and right. But this isn't going anywhere with us arguing whether it's right or wrong. The point is that if the only reason holding you back from trying out Python is its significant whitespace, then you're really stupid. I mean a total idiot. Even if the significant whitespace is only the proverbial straw that broke the camel's back, you're still an idiot for not trying out Python because of this.

    You need not like it after you've really tried it. You may as well say that you don't like the significant whitespace because you couldn't get comfortable with it. I would find that odd, but I wouldn't argue with you on that. However, if you dismiss Python as a viable alternative because of its significant whitespace; well, as I said, that's just stupid.

    Perhaps it's just the other way around?
  32. You might not want to migrate. by CyricZ · · Score: 2, Insightful

    If your existing PHP4 setup is working fine, or at least acceptably, you may not want to transition to PHP5. It has been suggested that PHP 5.0.4 suffers from very poor memory usage.

    http://books.slashdot.org/comments.pl?sid=158685&c id=13297391

    So at this point, it just doesn't sound like a transition may be a very good idea for a site that is already functional and running well.

    --
    Cyric Zndovzny at your service.
    1. Re:You might not want to migrate. by tangledweb · · Score: 1

      It has been suggested by an anonymous coward that PHP5 has poor memory usage. If that is the basis that you make technical decisions on for your projects then I have a bridge to sell you.

      The AC is nearly as dumb as the guy in this thread who said that linux should require PHP to magically detect and cripple poorly written scripts. ... Oh, I'm sorry, that was you.

  33. A rather large claim by sholden · · Score: 1

    Without any evidence at all.

    A smarter approach is to learn the language basics in sequence as rapidly as possible, not getting bogged down in excessive sample code.

    Define "excessive". And why is that way smarter?

    Learning by example is a pretty common pedagogic approach after all.

  34. Clarify for me. by Some+Random+Username · · Score: 1

    The whole "lambda" function concept is dumb how exactly? If you mean python having neutered lambdas instead of real ones, sure that's dumb. But the concept of lambdas isn't dumb at all.

  35. Wait a minute.... by mixonic · · Score: 2, Funny

    Wait, there is still a programmer that doesn't know PHP?

    color me stunned!

    -mix

  36. Re:To buy or not to buy, the reviewer doesn't know by Just+Some+Guy · · Score: 2, Interesting
    This book is clearly not intended to be one of those PHP + MySQL combo books that have proven so popular during the past few years.

    [...]

    Another potential point of criticism could be that the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL (the industry's favorite for use with PHP).

    But yet it does explain MySQL? Which is it? I'm not going to buy the book if the reviewer can't figure it out.

    In other words, the book isn't centered around building DB-driven apps using PHP+MySQL, even if it does discuss the topic. The reviewer wishes it also had chapters on PHP+PostgreSQL or PHP+Oracle, but it doesn't. Seems pretty reasonable and consistent to me.

    --
    Dewey, what part of this looks like authorities should be involved?
  37. Tasked by NickF · · Score: 2, Funny

    A professional programmer could at any time be tasked

    tasked
    Must be an MBA.

  38. I've just started to read this book... by kenh · · Score: 5, Informative
    and I've noticed a few things that don't bode well for the book (in no particular order):
    • Lack of labels on early figures/diagrams I noticed that some of the first chapter examples and diagrams were not labeled correctly.
    • Program names in examples don't match text (or vice-versa) The text will refer to an example with one name, but the actual screen print has a different name - not a huge deal, but combined with the previous point, it is a problem.
    • Handfull of errata in first few chapters none really major, but the sum total makes the reader feel the publisher rushed the book.
    • Instructional method not a good fit for early material The examples in the first few chapters are trivial, and strain the idea that this boo is aimed at anyone with programming experience. I would have prefered one big chapter that ends up with one, more complex example.
    • No common theme to examples Again, I'm only in the first few chapters, but the author keeps introducing new premises for the examples - in contrast, the IMS/DB books I read back in my mainframe days all relied on examples from the hospital domain - the lack of consistency across the examples is a distraction to the reader, who has to endure new "let's pretend your a..." setups for each new topic.
    • Inconsistent editing From my quick review of the last few chapters of the book, many of the above complaints are corrected, which makes me wonder about the editing/technical reviewing done on the manuscript.

    Overall, this is a pretty good idea for a book, but the editors/author should not have rushed it to press - the quality of the book appears to have suffered.

    I would strongly encourage a potential buyer of this book to spend several minutes with the book and see if the style suits your manner of learnig. Personally, I prefer the O'Reilly Learning series approach to teaching a topic, but preferences vary.

    --
    Ken
  39. yep, the whitespace thing tripped me up by rebug · · Score: 1

    ...for about five seconds.

    Seriously, if that's the extent of your case against Python, well...you make it clear that you've never actually written anything in Python and are therefore unable to have a valuable opinion of it.

    If you're using an editor that doesn't understand tabs or one that can't convert tabs to spaces, well, you should seriously consider getting a new editor.

    --

    there's more than one way to do me.
  40. And I'll say it again... by DigitalBlossom · · Score: 4, Insightful

    The only book anyone should be using for learning PHP is the PHP manual. We write it for a reason. The manual is the only resource I know of which is almost always up to date, maintained, and largely error free (We have errors, but as soon as they're reported they are fixed, usually within hours of the report being filed. Most of these types of errors involve spelling or gramatical mistakes.). Books released on the subject all do the same thing: re-write what the manual has already adequately stated while throwing in errors left and right.

    Arguably, there are a few books written which at first seem to be written well. Hell, who isn't tempted to pick up a book now and again which has names such as "Rasmus" and "Andi" etc stamped across the front in large gaping print. But these books are just as useless as those written by lesser-known authors, and shouldn't be used because of the same failings of other books: They're error-prone, and almost immediately deprecated. PHP changes rapidly, very rapidly. Possibly too rapidly for its own good, but that's another discussion entirely. Point being that you can't commit changes to the cvs repository of a book as you can to the PHP manual, and as such any printed book will fall far short of being as up to date as the PHP manual.

    If you need a resource to "teach you PHP quickly" there is generally only one chapter you need to read in its entirety, and that is php.net/langref. Anyone willing to take the time to do that can pick up the (extremely easy and basic) syntax of PHP within 2 to 4 hours. From there all one need do is hit the extension documentation pages of any API they may wish to use, such as php.net/mysql, php.net/pcre, etc.

    --
    I can help you change tired moments into pleasure, say the word and we'll be well upon our way...
    1. Re:And I'll say it again... by domanova · · Score: 1

      The man is right.
      There is 'learning the language'. Back in the day, it was 'The C Programming Language': K&R : you did not need anything else. PHP is like that, only it moves faster. Go to the source.
      Then there is 'what can I do with it?'. Libraries, functions, classes, modules,whatever they are called. Go to the most up-to-date source
      Then you get some value-added, perhaps: 'I've done this useful thing: watch how I did it'. There are your examples.
      Then there is the glory; how you make this stuff sing by inventing with it, not following. To be honest, the best of that I've seen are the C++ guru words. I've not been stunned by writing about PHP, yet, but then again I wasn't impressed by CSS (yawn) until I needed to do stuff with it.

      --
      Down with categorical imperatives
    2. Re:And I'll say it again... by shlashdot · · Score: 1

      I have to say Rasmus' book rocks for understanding quotes and strings, aka interpolation iirc. For me it was a great investment.

      --
      Additional plugins are required to display all the media on this page.
    3. Re:And I'll say it again... by onlyjoking · · Score: 1

      That would be fine if the ISPs had up-to-date versions of PHP but the opposite is usually the case. The casualty of PHP's fast pace of change is the ever-increasing number of legacy versions being offered with hosting deals. To service a number of clients using these kind of hosting deals one needs a complete history of PHP versions and feature history. This is the primary defect of packing so much into the language base. Although PHP presents itself as a common platform for web development version headaches and .ini variations make it a difficult platform to work with in practice, especially where your codebase is expected to last a long time. That the latest version of PHP is documented online means nothing because, a full year after its release, PHP5 isn't available with most hosting deals.

    4. Re:And I'll say it again... by Tablizer · · Score: 1

      he only book anyone should be using for learning PHP is the PHP manual.

      Some of us still find paper easier on the eyes for some reason, and easier to scribble arrows and notes onto. We have this debate every time PHP is mentioned. If your eyes like monitors, so bit it. Everybody is different.

  41. Re:Posting anon to protect the guilty by Anonymous Coward · · Score: 0

    you don't understand 'cause you're a fewl

  42. Re:Posting anon to protect the guilty by Dan667 · · Score: 1

    I realize that alot of Programmers like Java because it has alot of features, but as a user, I have yet to come across a Java website I did not hate. The minute it starts trying to force a loading of a runtime environment or jar files and screws up the back button or other standard controls I want to leave.

    Not trying to hate on Java, but please give an example of a Java coded website that has a pleasant user experience or list the object oriented web programming languague you really intended.

  43. Re:Posting anon to protect the guilty by Christianfreak · · Score: 3, Informative

    While I agree that PHP isn't all that great I think you have the reasons wrong.

    OO isn't a silver bullet. You almost always trade performance for development time and maintainability when you use it. That's not a bad thing and PHP minimizes the performance hit well enough to make it useful. In PHP its nice when the developer sticks to one or the other, though its obvious that most people don't because PHP is easy and the people writing it tend to be new to programming.

    Strong typing isn't a silver bullet either, and I don't see how it makes your code more reliable. PHP tends to die when you perform numeric calculations on a string or vice-versa so problems can be fixed before going to production. I'd prefer it handle more like Perl where usually it does the "right thing" (it doesn't die at the very least).

    Here's my problem list that I hoped would be fixed or at least improved in 5. (no such luck it seems)

    Error handling is one of my biggest beefs with PHP. There are simply too many options and none of them are sane. Why can't we have a class as an error handler? Why is it that the error messages are spewed the screen as HTML by default? Why doesn't the command line mode revert to text only error messages? Why doesn't PHP just use the server error log like other languages and give you options to change it if you need to? That's what its there for!

    References: Worse than PHP 4's objects are its references. Why can't I have references to objects or code? Why can't I pass a reference to any user defined or built-in function? (it used to work for user defined functions then they depricated it)? Seriously why does the function care if it has a reference or a value? To be fair I've heard some of these things have been fixed in 5 but I've still not found definitively if you can have code or object references.

    Scoping: I suspect part of the problem with references are due to limitations in scoping. On the surface, having all locally scoped variables and specifying when you want to use a global one makes sense and keeps new programmers out of trouble. The problem is it leads to undefined variables everywhere when the programming forgets to use 'global $foo' in a function. This is also a problem that can be hard to spot initially because PHP doesn't bother to warn you if you've done that. The 'global' keyword also looks like a declaration so when I was first learning the language it was extremely confusing. PHP would be much more tolerable if they adopted something similar to Perl's strict mode where you declare your variable in the global, package, or local scope and it dies when you have variables that are undefined. This method is much better than having silently undefined variables.

    Namespace polution: Why are there 14 billion functions I'll never use all in the same scope? Its silly. C came up with the idea of including what you need 35 years ago! Why are we regressing? Even if you don't like having separate namespaces, at the very least functions that go together could all be in a common file to be included and then you only import functions you need. And no OO won't solve this problem because all the core functions are still imported in, even in PHP 5.

    Compiled modules: Why do I have to recompile PHP if I want to add image functions or some other module written in C?

    HTML Centric: PHP centers around HTML (see my beef about the error messages above) This is a real annoyance if you want to output other things. Also the default embedding in presentation is irritating too. It was a bad idea with ASP, it was a bad idea with ColdFusion and its still a bad idea now and while the developers keep saying "you no longer have to embed it", so what? Make it where it can't be embeded. (yeah yeah, backward compatability and all that) Sure you can cause other languages to print out HTML using print statements, but its not the same. PHP is designed around embedding it within HTML. Print statements make obvious the need for templates. PHP makes a mess without making it obvious un

  44. Re:Posting anon to protect the guilty by seek31337 · · Score: 1

    In your extensive research, eh?

    brian@vicky> php -h
    .. SNIP ..
    -l Syntax check only (lint)

    --
    No SIG for you!
  45. I love PHP by killermookie · · Score: 2, Insightful

    I'm a huge PHP fan.

    But even I'm getting sick of these PHP reviews.

    1. Re:I love PHP by huckda · · Score: 1

      try ruby on rails http://www.rubyonrails.com/

      I doubt you'll be disappointed

      --
      "Just Smile and Nod." --Huck
  46. other PHP books by Tumbleweed · · Score: 1

    I like the idea of the Visual QuickStart Guides - I've flipped through (and bought but not yet read) the one for Python, but the one for PHP doesn't cover PHP5-specific stuff, despite the cover blurb, according to some people who've read it. Hopefully an updated version is forthcoming.

    I recently got, and am slowly going through, "Beginning PHP 5 and MySQL: From Novice to Professional," and it's okay, but no more than that. A strange ordering of what's taught when, but it's working thus far. I hope it works for me, as I'm taking over a PHP/MySQL project at work the week after next. Eek!

    And of course, I just found out that an updated version is due out at the end of October. Figures.

  47. Re:Posting anon to protect the guilty by Decaff · · Score: 1

    I realize that alot of Programmers like Java because it has alot of features, but as a user, I have yet to come across a Java website I did not hate.

    How do you know you are using a Java website?

    The minute it starts trying to force a loading of a runtime environment or jar files and screws up the back button or other standard controls I want to leave.

    The runtime environment and jar files are only loaded once - when the application server starts. From then on, these do not occur, so have no impact on anything.

    The use of controls is highly specific to the way an individual developer has coded their website and used a web framework. It has nothing whatsoever to do with Java.

  48. Re:Posting anon to protect the guilty by DazzaD · · Score: 1

    There is a difference between server-side Java where all you see is the HTML output and browser-side Java where you see the problems you mention.

  49. Re:Posting anon to protect the guilty by Decaff · · Score: 2, Insightful

    "In Java, I can create objects, store them in sessions, hand them to threads, and store them using persistence frameworks. PHP has only the most rudimentary versions of such features."

    Good for you. What are the advantages of doing what you're doing that obsolete PHP in every instance?


    Scalability. The ability to share objects and information between threads, so that they can be used throughout an application and not just within a request or session is vital for large high-performance websites. It is simply not practical to drop through to the database to reload information each time when you have hundreds or thousands of simultaneous users.

    "so you end up with no separation between HTML and code, and you end up with an unmaintainable mess."But what's to stop this from happening in ANY language? And what's to stop it NOT happening in PHP?

    In Java, for example, there are web development frameworks such as Tapestry, Struts and JSF, that have cleanly separated presentation and code layers. As for stopping it in PHP - that is tricky, as PHP was designed for HTML + code mixing.

    Please explain more - I don't know what filters are. I'd be very surprised if PHP could not support whatever-they-are.

    Filters allow specific ranges of URLs to have additional functionality wrapped around the requests. This is a highly useful feature, allowing things like post-processing of HTML, or checking authorisation (and diverting to error pages).

    There may be add-ins for this, but as far as I know, it is not standard for PHP, as it is in Java.

  50. Re:Posting anon to protect the guilty by digidave · · Score: 1

    He was talking about applets, which suck except for special purposes. In those cases, only Java will do.

    --
    The global economy is a great thing until you feel it locally.
  51. Re:Posting anon to protect the guilty by Decaff · · Score: 1

    He was talking about applets, which suck except for special purposes. In those cases, only Java will do.

    No - it is nothing to do with applets. He was talking about the frameworks available in Java to render HTML and handle web forms.

  52. Advanced!=Complex!=Dirty by fireboy1919 · · Score: 1

    None of these things are the same at all.

    Beginners tend to use global variables and long, imperative structures for pretty much everything no matter what language they're using.
    They also tend to use the same control structures for everything until they start understanding other ones. And forget about OOP or functions. These things are advanced.

    What they end up with is something that's supremely simple, but very, very dirty. The code doesn't scale at all. It almost has to be completely rewritten by hand even if they comment their work.

    So simple can be bad. So what about advanced things? One primary thing that people do that's advanced is add syntactic sugar to make it easier for them to follow. An example of this is using Templates in C++, or "autoload" in perl. You really have to understand the inner workings of your language to do these things, but if you know them it eliminates code that doesn't contain anything meaningful (thus making it the code less complex to follow).

    The list doesn't end there. What framework do you choose to do your design in? Using a suitable framework may be more complex for small projects, but considerably less complex for giant ones. Frameworks are usually very advanced topics, because they don't usually carry over between languages at all.

    I'd like to think that I write less complex, cleaner, more advanced code than most PHP writers.

    --
    Mod me down and I will become more powerful than you can possibly imagine!
  53. Re:Posting anon to protect the guilty by Decaff · · Score: 1

    Actually, you are right! Ignore my previous post. The 'back button' issue confused me.

  54. Cargo cult programming by Michael+Woodhams · · Score: 1

    ...copy and paste code that looks applicable to the task at hand, and then lose valuable time trying to make it all work and control what was created ...

    This is what I call "Cargo cult programming" -- when you copy something that worked somewhere else, make what look to be the appropriate changes, and hope.

    Although not admirable, I have done this a number of times. (JCL! Argh!) Sometimes you just need to make a minor change to a program in a language you don't know.

    The Jargon file has a slightly different definition of cargo cult programming.'

    --
    Quattuor res in hoc mundo sanctae sunt: libri, liberi, libertas et liberalitas.
  55. Re:To buy or not to buy, the reviewer doesn't know by An+Onerous+Coward · · Score: 1

    Pedantry is annoying. Misguided pedantry is a hundred times worse.

    "The book is clearly not intended to be one of those PHP + MySQL combo books" : The book does not have a heavy focus on MySQL.

    "For simple database needs, the material in that chapter might be sufficient. Yet for more extensive MySQL usage, including installation and administration, other resources will need to be consulted." : The book covers MySQL, but not in too much depth.

    "...the book does not adequately explain how to use PHP with the various available database systems, only covering MySQL..." : The book does not cover databases other than MySQL.

    While the reviewer might be faulted for his writing style, you can't get an actual contradiction out of his statements unless you grossly misinterpret him.

    Finally, there's the whole matter of you judging the quality of a book on the basis of the presentation of the reviewer. If you find the reviewer so confusing and incoherent, shouldn't that just mean that you don't allow the review to inform your opinion?

    --

    You want the truthiness? You can't handle the truthiness!

  56. Re:Posting anon to protect the guilty by digidave · · Score: 1

    The reason why PHP is *not* a disaster are:

    1. It has mechanisms to allow you to program extremely tight web apps in one of several frameworks and programming models. This includes very Java-like MVC if you want or the very awesome Prado.

    2. PHP does not tie you down to an OO paradigm, but lets programmers choose to implement an app using structured code, OO code or a hybrid of the two. This lets programmers code the way they feel comfortable.

    By the way, PEAR is not a strong point for PHP. It's a useful programming library for beginners, but advanced programmers use it very sparingly since it's not laid out well, not documented well and in many cases does not perform well (especially the database classes). There are very well-written task-specific libraries such as Adodb that do a far better job and are becoming the defacto standard for PHP programmers.

    Java filters are little more than a trick which Java (and other languages) programmers have been doing for ages. All they do is make programming a bit easier, which is great, but considering how much quicker PHP programming already is than Java programming, you can understand why Sun keeps trying to find ways to do all the hard work for Java programmers... they have to compete with better RAD languages.

    PHP5's (and 4's) objects are certainly not as true OO as Java's, but that mostly stems from the fact that PHP isn't trying to be another Java. C++ isn't as OO as Java either, but it's still a useful language. PHP's objects are there to modularize and reuse code. They help improve the overall application design and move the business code away from the flow control code. The rest of PHP's design allows for its objects to not support everything that Java does. Sure, there are times this is a shortcoming, but its one of PHP's quirks that PHP programmers design their apps around. All languages are like that... it's very difficult to design and pseudocode a program without knowing which language it will be written in. That's like designing a database without knowing if it will be for Oracle, DB2 or MySQL... sure it can be done, but by not tailoring to the platform you can't workaround a platform's weaknesses or design for its strengths.

    PHP is a great choice as a high-performance and flexible language. As one of the very few languages designed specifically with web apps as its primary goal, PHP is tailored to do exactly what web programmers need. Most of the limitations in the language are at the crossover point between traditional client apps and web apps and nearly all have simple workarounds, such as serializing an object when storing it in the session.

    --
    The global economy is a great thing until you feel it locally.
  57. PHP gets on my nerves by Anonymous Coward · · Score: 0

    Thank goodness there are languages like, well, anything else that have a cleaner more consistent design.

    This just tripped me up the other day. I thought to myself "cool, now I can use the regular $obj->foo notation but have it call a method underneath. Just like Ruby. That will make refactoring a breeze" Boy was I wrong. Try this out:

      class Crap {
        private $attributes = array('crud' => array(1,2,3));
        function __get($name) {
          return $this->attributes[$name];
        }
      }

      $c = new Crap;

      foreach ($c->crud as $x)
        print $x ."\n";

    Why does PHP make things look like they might work, but then they don't?

    I'm also trying to figure out the purposes of "toString()", or why there's no "finally" for exception handlers, or why built-in functions don't throw exceptions.. what's the point of having them??

    Yeah, newbies don't care, but you know, sometimes newbies actually get better sometimes and want to do more things?

    I'm sticking with Ruby for now, thanks.

  58. Smarty?!? My GOD, people use that trash? by Anonymous Coward · · Score: 0
    There is hope. There are some tools like Smarty Templates and PEAR which help a little bit. In fact if beginners would force themselves to use Smarty Templates from the beginning they would get much better results.
    Yeah, because using a templating language (Smarty) which is implemented in yet another templating language (PHP) is a really bright thing to do. You don't need Smarty to separate your layout code from your 'application' code.

    PHP ruins people who might have been somewhat decent coders, if they'd just started out in an environment that enforced some structure and best practices. PHP's biggest failing? It has no framework. It's just glue.

  59. Re:Posting anon to protect the guilty by bobbyjack · · Score: 1

    "It is simply not practical to drop through to the database to reload information each time when you have hundreds or thousands of simultaneous users."

    It is. I've worked on a site (NB: NOT my URL!) that handles greater traffic than that, with a large number of DB requests on a large proportion of pages. NOT written in PHP. But not even running on a box of its own ...

    "As for stopping it in PHP - that is tricky, as PHP was designed for HTML + code mixing."

    If you want a dynamic web site, you have to mix HTML with something at some point. It may be characters in a file, string delimiters, php delimiters, whatever. I don't see anything in the PHP language itself any different from any other language in this regard. HTML is just a bunch of strings; PHP can be written with nothing outside of the <?php ... ?> at all.

    "Filters allow specific ranges of URLs to have additional functionality wrapped around the requests. This is a highly useful feature, allowing things like post-processing of HTML, or checking authorisation (and diverting to error pages)."
    Forgive me if this sounds flippant, but isn't that something than can be achieved with an array, a regexp or two, and REQUEST_URI? Is this something actually within the language itself?

  60. yah uhm by Anonymous Coward · · Score: 0

    It's Perl, not PERL. Unless you're running it on a MAC, I guess.

    PHP is so easy because it's made for stupid people.

    1. Re:yah uhm by Anonymous Coward · · Score: 0

      nice real nice.. stupid people huh.. Who needs complicated? You scared for your job? Too uncreative to innovate and compete with stupid people? why dont you just go play with a gun or something.

  61. Re:Posting anon to protect the guilty by Dare+nMc · · Score: 1

    >php -l

    call that lint if you want, that is just a syntax check.

  62. Let's wait for PHP 5.1 or 6 by dostick · · Score: 1

    5.0 is a small step ahead. 6.0 will be a new level for PHP.
    In 5.0 only part of intended features implemented, and many of new stuff implemented half-way. Like for example, idiotism of exceptions being thrown in user code but not from standart PHP functions!

    PHP 5.1 (due out this year) seem like a wasted time so far. Zend spent all time implementing useless "Data objects" instead of working further on new OO features.
    "Data objects" itself is just a database access classes that are already available in numerous PHP class libraries. They just re-implemented it as PHP module.

    One of most requested features, namespaces support was dropped in 5.0 because it was "too complex to implement". It may appear in 5.1 but more prabably in 6.0.
    6.0 may also have strong typing anong other long-awaited features.

    Hopefully 6.0 will be that "golden" version where it will please Java-minded developers and be compatible with un-responsible rapid development style.

    1. Re:Let's wait for PHP 5.1 or 6 by Anonymous Coward · · Score: 0

      PHP6 would be better if they ditched ZE altogether and just went with parrot. PHP as a language will survive, the current runtime is simply horrible.

  63. Re:A smarter approach? Learn the idioms and toolki by Anonymous Coward · · Score: 0

    Who modded this insightful?

    Those worried about toolkits don't want to learn the language, they just want to use toolkits to make it appear that they know the language.

    Look, dude, in my experience, a language becomes useful when you learn enough to do something useful. Not before.

  64. Re:Posting anon to protect the guilty by Anonymous Coward · · Score: 0
    Gonzo is back again. Sweet jebus you are dense.


    It is. I've worked on a site (NB: NOT my URL!) that handles greater traffic than that, with a large number of DB requests on a large proportion of pages. NOT written in PHP. But not even running on a box of its own ...


    So what you are telling me is, it's ok to hit the server for a piece of data that isn't changing soon or is complex to get? Lemme guess, calculate and store it in another table? Ugh. Amature.


    If you want a dynamic web site, you have to mix HTML with something at some point. It may be characters in a file, string delimiters, php delimiters, whatever. I don't see anything in the PHP language itself any different from any other language in this regard. HTML is just a bunch of strings; PHP can be written with nothing outside of the at all.


    A good template language limits the logic you can put in. It limits it by not giving you the functionality, or makes it hard to. That's why scriptlets in jsp are so disdained. If I can do on a whim, that's horrible. It's the reason why velocity, freemarker and others are prefered. But keep deluding yoursel fthat everyone has good enough expierience and diligence NOT to put complexity in your templates.. i'm sorry "php programs".


    Forgive me if this sounds flippant, but isn't that something than can be achieved with an array, a regexp or two, and REQUEST_URI? Is this something actually within the language itself?


    Quick, you have 500 templates that need a new filter. Sorry, "php scripts". I have 500 servlets that need a new filter. I'll finish way before you.
  65. NOT USE PHP??? by Anonymous Coward · · Score: 0

    So you're saying that professionals use *gasp* ASP???

    1. Re:NOT USE PHP??? by eyeye · · Score: 1

      ASP.NET would be much better, or Perl (strict and OO) or JSP. Basically a real language :-)

      --
      Bush and Blair ate my sig!
  66. Re:Posting anon to protect the guilty by Decaff · · Score: 2, Insightful

    "It is simply not practical to drop through to the database to reload information each time when you have hundreds or thousands of simultaneous users."

    It is. I've worked on a site (NB: NOT my URL!) that handles greater traffic than that, with a large number of DB requests on a large proportion of pages. NOT written in PHP. But not even running on a box of its own ..


    It is not practical for anything but the simplest and smallest of data items. If it were, sites like E-Bay and high-volume stock markets would work like this. They don't.

    If you want a dynamic web site, you have to mix HTML with something at some point. It may be characters in a file, string delimiters, php delimiters, whatever.

    Yes, but what you don't want to mix is logic. Someone should not have to look through lines of HTML to see how you are doing a price calculation!

    Generally, web frameworks have specialised tags that are included in the middle of HTML to indicate where the results of processing are to be included.

    I don't see anything in the PHP language itself any different from any other language in this regard. HTML is just a bunch of strings; PHP can be written with nothing outside of the ?php ... ? at all.

    You can, but the mere fact you have those enclosing symbols indicates that the language was designed to allow embedding in HTML, and not to discourage it.

    "Filters allow specific ranges of URLs to have additional functionality wrapped around the requests. This is a highly useful feature, allowing things like post-processing of HTML, or checking authorisation (and diverting to error pages)."
    Forgive me if this sounds flippant, but isn't that something than can be achieved with an array, a regexp or two, and REQUEST_URI?


    It can, but why bother re-implementing this each time? Filter APIs allow Filter classes to be written in just a few lines of code.

    Is this something actually within the language itself?

    No. It is a standard part of the JSP/Servlet API, which is a subset of J2EE.

  67. Re:A smarter approach? Learn the idioms and toolki by ezzzD55J · · Score: 1
    "In my experience a language becomes useful when you also learn the frequent idioms and know the available toolkits."

    Idioms? Don't you mean memes?

    (I'm making fun of the over-use of the word 'meme' round these parts, for those that are wondering what I am saying here.)

  68. Re:PHP gets on my nerves; then stfu! =p by v3xt0r · · Score: 0

    that code doesn't work because it's written incorrectly.

    Learn the language 1st, then bitch about it later! =p

    --
    the only permanence in existence, is the impermanence of existence.
  69. Re:Posting anon to protect the guilty by seek31337 · · Score: 1

    OH! You want to replace developers with a floppy disc. Good luck!

    I was addressing 'not being able to see compile errors in anything but a web page'...

    What amazes me about this whole discussion is how nearly everyones complaints about PHP contain serious errors, and are totally unresearched. I can only assume this is largely based upon what other people told them, rather than actual experience.

    I never have heard anyone, respectable or otherwise, proclaim "We took x application, and re-wrote it in /some non-php language/, and it was so much easier to (debug|write)!"

    --
    No SIG for you!
  70. Re:Posting anon to protect the guilty by Decaff · · Score: 1

    I don't usually post to defend those I am debating against, however...

    Gonzo is back again. Sweet jebus you are dense.

    This is totally unfair. The poster is asking questions I would expect from someone experienced with the PHP way of working. They are intelligent questions.

    So what you are telling me is, it's ok to hit the server for a piece of data that isn't changing soon or is complex to get? Lemme guess, calculate and store it in another table? Ugh. Amature.

    It is not that simple. Fetching data for each request or each session can be useful in some ways. It allows all all the data relating to an application to be changed without having to restart an application - effectively shutting down the web application. Changing application-scope data in Java is possible, but it requires careful and thread management.

  71. Re:Posting anon to protect the guilty by TerrapinOrange · · Score: 1

    "It is. I've worked on a site (NB: NOT my URL!) that handles greater traffic than that, with a large number of DB requests on a large proportion of pages. NOT written in PHP. But not even running on a box of its own ..."

    The major bottleneck for most websites is the database. Pick up, well, pretty much ANY book about writing dynamic web sites, be it in PHP, Ruby, Java or whatever, and you'll likely find major sections dedicated to optimizing your db access code. Any help the language or framework can provide in this area directly leads to a faster, more scalable website.

    Java has tonnes to offer here, nearly to the point of being ridiculous. With Hibernate (a popular Java data access framework), I don't have to write ANY data access code at all. All I have to do is provide a little extra meta information in my classes so it understands my relationships, give it a config file so it knows how to connect, and it takes care of almost all of the rest. It will even generate the database for you, if you want it to. For most tasks, it will do exactly the right thing without any extra work, yet still provides many ways to tweak the trouble areas.

    PHP also makes it incredibly tempting to do the wrong thing. If I want to put a SQL query right in with my HTML template, it won't do anything at all to encourage me to do otherwise. In fact, in PHP this is the easiest place to put it... I suspect that many PHP programmers don't even realize that this is generally a very bad practice. Part of PHP's charm is that you don't have to learn complicated frameworks or patterns, which is just great for someone who wants to get off and running right away. However, without some sort of structure things can become an unmaintainable nightmare in no time at all.

    "If you want a dynamic web site, you have to mix HTML with something at some point. It may be characters in a file, string delimiters, php delimiters, whatever. I don't see anything in the PHP language itself any different from any other language in this regard. HTML is just a bunch of strings; PHP can be written with nothing outside of the at all."

    Logic and presentation should be separated. It makes updating both easier, and it helps remove unnecessary dependencies between the two. The easiest thing to do in PHP however is to just stick them all in the same file. Contrast this to a Java framework like Tapestry, who's html component is simply a plain jane html file, with a single extra attribute added to the tags that Tapestry is interested in. This can be previewed in a standard web browser.. the entire look and feel of the site can be changed by someone who doesn't even know what Tapestry is. And, when I decide I want to switch from HTML to WML, or to a desktop application, all of my logic is cleanly separated, ready to be reused however I like.

    It is of course possible to do this in PHP using Smarty templates or something similar, but the easiest approach is to just not think about it. For simple applications, this may never turn into a problem, but for anything moderately complicated the lack of separation can turn into a real issue.

    Don't get me wrong.. I think PHP is great. It was the first web programming framework I really fell in love with, and I've seen some amazing things done with it. It's incredibly easy to pick up, and it will scale just about as far as you want to go with it.

    However, writing sophisticated PHP applications requires just as much discipline as writing sophisticated Java applications, and I just find Java gives you so much more. Take a good java programmer, give them best of breed open source tools like Hibernate, Tapestry and Spring or Hivemind, and they're going to code circles around just about anyone else. Using these tools you can prototype an application incredibly quickly (faster in my experience than PHP, Perl, or anything else except for Rails), then evolve that application one piece at a time into a full, production ready enterprise app.

    Of course, n

  72. Re:Posting anon to protect the guilty by Decaff · · Score: 2, Insightful

    That said, Ruby on Rails is amazing. If java isn't your bag, check it out. It has most of the best features of Java and PHP, almost none of the warts, and a whole bunch of great stuff you won't find anywhere else.

    After all your praising of Hibernate, how can you recommend this? Hibernate is an elegant and robust ORM that isolates your code from database specifics and allows you to write highly portable applications. Ruby on Rails requires exactly the kind of embedded SQL you don't like if you are to do anything complex, and makes your application extremely dependent on the database schema and the specific column names contained within it, and has serious barriers to portability.

    I agree strongly with almost every aspect of your post, but certainly not this last part!

  73. Re:A smarter approach? Learn the idioms and toolki by Nasarius · · Score: 1

    The only thing worse than 'meme' is 'memetics'. Which in the real world outside the blogosphere-wankery is called, you know, anthropology. *sigh*

    --
    LOAD "SIG",8,1
  74. Re:A smarter approach? Learn the idioms and toolki by mbrod · · Score: 1

    the frequent idioms and know the available toolkits

    What are you talking about?

  75. Re:Posting anon to protect the guilty by Anonymous Coward · · Score: 0
    I'm glad all those who don't understand what I'm talking about modded this as flamebait. I can see in some later posts that some people who think they know... really don't know, like the person who said that Servlet Filters are trivial and you can easily do the same thing in PHP. I'm also impressed to see that Slashdot readers don't understand the relevance of things like OO design, separation of display and logic, why persistence frameworks are useful, that kind of thing. I mean, seriously, when you develop a Servlet app, all of your code is either a) in a Servlet/Filter or b) in a custom tag library or c) in some other framework tool like Struts. You end up with HTML code with a few custom tags scattered in it, and you end up with all the biz logic in pure Java files.

    Whereas if you take a look at any but the best-disciplined PHP project, there's not a file anywhere that doesn't have some HTML and some PHP.

    Those who have experience in real web application design know what I'm talking about and understand the importance of this discipline. Guess what, people with that level of understanding probably also know how to use Java and know enough to appreciate it.

    For the others who don't know this, you will keep on creating PHP apps. If your business does well, the demands on those apps will keep on growing, the apps will get more tangled as the less-clueful PHP developers expand them, and eventually you'll end up with a big mess and you'll need to spend some big bucks on someone like me to sort out the mess.

    If a web-based business is really smart they'll spend some not-so-big bucks on someone like me early on to get their project onto the right foundation and then they won't need a major rescue effort a year or two later.

  76. This problem requires two solutions. by CyricZ · · Score: 1

    That's what I'm saying. Of course PHP isn't Linux. But most people, including the managers who are the ones making the final decisions regarding the use of Linux in enterprise or business settings, don't know that. They've come to think of the flaws in PHP scripts as being flaws in Linux.

    This is both a social and a technical problem. You have to fix PHP so it is difficult, if not almost completely impossible, for amateurs to write scripts that can be exploited. Likewise, PHP and Linux shouldn't be linked as often by Linux advocates. The only way to fix this is to deal with all aspects of the problem.

    --
    Cyric Zndovzny at your service.
  77. SPL, PEAR, Smarty, etc by Anonymous Coward · · Score: 0

    I'm still looking for a book that covers PHP 5's OO programming, including the Standard PHP Library (SPL), Pear classes (there are a million of them now), Smarty templates and more. I'd especially like a book covering the 100's of PEAR classes since 95% of them are not documented.

  78. Re:Posting anon to protect the guilty by TerrapinOrange · · Score: 1

    Rails lets you alias column names to provide some level of abstraction away from the database. Many people don't do this, as it's easier just to go with what's in the db, but renaming a column would only require one line of code to be added to object. It's also possible to perform some types of queries without any sql. Hibernate it's not, but I'd say that the average Rails app is more adaptable to db changes than the average JDBC application, which still isn't too bad.

  79. PHP5 would cost us $15,000 to run by kstumpf · · Score: 2, Interesting

    PHP5 is a memory hog. I realized this after writing a sizeable application in PHP5's new object syntax for our 7-server cluster. Everyone is so busy comparing PHP4 to PHP5 by benchmarking a script that prints "hello world" 5000 times, nobody has noticed the memory usage.

    PHP5 DOES runs great if you run it through Zend Platform (an opcode accelerator), which costs $1500 a year per dual-CPU server. There are free alternatives to this (eAccelerator and APC), but none of them optimize the new PHP5 class syntax like Zend, and talk of instability is common. Do some simple memory benchmarks and you will see (just load your classes, you dont even run any code it to see it guzzle memory!!).

    For us to run PHP5, it would cost over $15,000 per year, which is more than our servers are worth!

    I feel held at ransom by Zend. Small shops like us are left out in the cold. We are abandoning it and switching to mod_perl and Catalyst on CentOS4.

    PHP does not feel "free" the way Perl or Apache are. I guess it is Zend's language after all.

  80. Fork! by Tablizer · · Score: 2, Funny

    Time to fork PHP into the bloated Java-chasing PHP5, and the nimble PHP 4.

    Call the 5 fork PHOOP :-)

  81. Re:And I'll say it again... (correction) by Tablizer · · Score: 1

    correction: should be "so be it". See what monitors do to proof-reading ability :-)

  82. Re:Posting anon to protect the guilty by Decaff · · Score: 1

    Hibernate it's not, but I'd say that the average Rails app is more adaptable to db changes than the average JDBC application, which still isn't too bad.

    I have to disagree. The average JDBC application explicitly extracts information for all columns, and the relationship between columns and Java variables can be tested either by compilation or by unit tests.

    Hibernate it's not, but I'd say that the average Rails app is more adaptable to db changes than the average JDBC application, which still isn't too bad.

    It is very bad! The point of systems like Hibernate and JDO and EJB3 is to progress away from database dependence. Rails encourages dependence on database schemas. This is something many of us have been trying to move away from for years.

    Rails is a huge step back to the way things were a decade ago.

  83. Re:Fork! (php6/parrot) by kstumpf · · Score: 1

    I was more interested in the rumors of PHP6 running on top of parrot. Many (most?) of the PHP developers are employed at Zend, so I don't see why they would do this. Of course, anyone could make a PHP-like language, but I believe their license prevents you from naming it something similar to PHP. ... we all know the language needs alot of work anyways. :)

  84. Requirements by Anonymous Coward · · Score: 0

    > A professional programmer could at any time be tasked with developing a nontrivial application using a language or Web technology with which he or she is unfamiliar.

    And an asteroid could at any time fall over your head. Seriusly, I have been presented with the task of develoing a nontrivial web application, and, after evaluating my options, I went with the language I was more comfortable with: C++ (the CGI protocol is *not* that complex).

    I have never had such draconian requirements as to be forced to develop a new and complex application in a language I have zero experience with. I'm sorry, but I can't think of a reason for this to be, other that your boss/client beeing stupid, of course.

  85. Re:Posting anon to protect the guilty by free_agent_777 · · Score: 0

    Anybody who doubts the power of how far PHP has come should have a look at the PRADO Framework. It's the fastest RAD framework I have ever used for PHP, with clean and clear separation of HTML Templates, Database Access and Modules

  86. Re:Posting anon to protect the guilty by 1110110001 · · Score: 1
    So you work with PHP every day - why don't you just read the manual?

    HTML Output in the CLI? Nope:
    $ php -r "echo 1/0;"
     
    Warning: Division by zero in Command line code on line 1
    Don't use the CGI if you really want the CLI SAPI.

    Can't use strings in numeric operations? Or even dying? Nope:
    $ php -r "echo 'a'*'b'; echo '1'+'a';"
    01
    Everything is converted. A string to integer conversion takes the leading digits and makes that an int.

    HTML Centric? Actually it's XML centric. are PIs.

    Need to reference a function? Put the name a string in a variable:
    php
    <?php
    function foo() { echo 'bar'; }
    $x = 'foo'; $x();
    ?>
    [ctrl+d]
    bar
    Modules have to be recompiled? Nope. Make a DLL or SO and load it via php.ini. That's where phpize is used.

    You have a long way to learn PHP ...

    b4n
  87. Re:Posting anon to protect the guilty by Dare+nMc · · Score: 1

    > OH! You want to replace developers with a floppy disc. Good luck!

    no, just to separate my 4am code, before the caffeine kicked in, from my in the zone code.

  88. Re:Posting anon to protect the guilty by Christianfreak · · Score: 1

    $ man php
    No manual entry for php

    Oh you meant read the online wiki. Where do I quickly and easily find those command line options?

    As for dying because of problems with types. There are problems with some built in functions that don't properly convert. Try pulling numbers out of a regex match and then plugging them into checkdate(). It treats them as strings and returns false (PHP 4). Hopefully this is just a bug and will be eventually resolved.

    As for references, no I didn't know you could do that. I knew you could pass a string of a function name to several built-ins so I assume this is the same mechanism. Still its stupid syntax, what's wrong with $x = &foo();?

  89. Re:Posting anon to protect the guilty by 1110110001 · · Score: 1

    The PHP manual, which is a docbook - so you could call it anti-wiki ;), has a chapter about the CLI stuff: http://php.net/manual/en/features.commandline.php - or you should install the man page on Mac OS X I have one. Or you could just call php with -h - -v gives you BTW the version and tells you which SAPI it's been compiled with (cli, cgi, fcgi).

    The syntax $x = &foo(); would call a normal function called foo and assign a reference to the return value $x. That's already a valid syntax, thus it can't be used for a new feature. And it's the way you handle returned objects in PHP4. As Marcus Börger said: "If your OO code doesn't work , throws some amps around. If it still doesn't work user more" ;) This stuff has been solved in PHP5.

    The variable function call syntax has an other advantage - it can also be used for method calls. See http://php.net/manual/en/language.pseudo-types.php #language.types.callback for information about callbacks (that's how it's called in PHP).

    If you've more questions about PHP don't hesitate to ask =)

    b4n

  90. Re:Posting anon to protect the guilty by Anonymous Coward · · Score: 0

    > $ man php
    > No manual entry for php

    > Oh you meant read the online wiki.
    > Where do I quickly and easily find those command line options?

    Funny, when I type "man php" I get this:

    PHP(1)    Scripting Language   PHP(1)
    NAME
       php         PHP Command Line Interface 'CLI'
    SYNOPSIS
       php [options] [-f] file [[--] args...]
    etc.

    I'm using a Mac, what are you using?

  91. Re:Posting anon to protect the guilty by Anonymous Coward · · Score: 0

    Amateurish. It doesn't even have input validation.

  92. Re:Posting anon to protect the guilty by Anonymous Coward · · Score: 0

    There are a bazillion frameworks for object-caching that don't require careful thread management. PHP doesn't even give you the opportunity.

  93. PHP is nothing but a email harvest racket by jistanidiot · · Score: 1

    I was going to convert our website from Windows IIS ASP to Linux/Apache/PHP. I had read all the hype and thought it would be a good move.

    Oh boy it wasn't. I joined a list on php.net to help me figure out how to install. Almost all of the messages were about people asking to be removed from the list. Then I posted a question and was told I had to visit three different website in order to be able to submit it. After the third one the message was still not posted and my spam folder was growing fast even for gmail. I attempted to unsub using the directions at the bottom of some posts. It didn't work. So I contacted the list admin. After a few emails, he became belligerent and eventually claimed he had nothing to do with the list! I then went to php.net, but I read the fine print, that anything I sent to their address would be reposted on usenet for spammers to harvest my address.

    So now my address is trapped on the spam list and my new gmail account is now full of spam (even with gmails filtering). I report each and every message now as spam. All I can say is that I'm lucky I didn't convert our production server yet, no telling what could be written in the PHP code. I have wiped the harddrive of the test box and reinstalled Windows IIS ASP. It is just amazing this spam harvesting scheme has come this far. Avoid the PHP spammers! Just say no to PHP.

  94. Re:Posting anon to protect the guilty by Decaff · · Score: 1

    There are a bazillion frameworks for object-caching that don't require careful thread management. PHP doesn't even give you the opportunity.

    True, but you don't persuade developers to switch by insulting them.... (as the grandparent post did)