Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Learning PHP 5

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

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

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

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

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

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

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

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

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


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

This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • Two free books on PHP (Score:5, Informative)

    by prostoalex (308614) on Thursday October 28 2004, @04:33PM (#10657929)
    (Last Journal: Monday October 23 2006, @12:44PM)
    For the beginners it's worth noting that two PHP books are available for free on the Web (outside of PHP.net documentation).

    A Programmer's Introduction to PHP 4.0 [apress.com] from Apress

    Practical PHP Programming [hudzilla.org] online book

  • I have a bit of a bone to pick. (Score:5, Interesting)

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

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

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

    PHP is maturing. Its version number is the same as Perl; it's more popular than Perl; it's almost as mature as Perl. It has more users than Perl, more bug fixes being put out, and its few idiosyncrasies are very well known. Frankly, there's fewer traps for a beginning PHP user than a beginning Perl user.
    • Re:I have a bit of a bone to pick. by Goaway (Score:1) Thursday October 28 2004, @05:28PM
    • Re:I have a bit of a bone to pick. by Anonymous Coward (Score:1) Thursday October 28 2004, @05:41PM
      • 1 reply beneath your current threshold.
    • Re:I have a bit of a bone to pick. by rainman_bc (Score:3) Thursday October 28 2004, @06:08PM
    • Re:I have a bit of a bone to pick. by hundalz (Score:1) Friday October 29 2004, @03:31AM
    • Re:I have a bit of a bone to pick. by juiceCake (Score:1) Friday October 29 2004, @08:51AM
    • Re:I have a bit of a bone to pick. by Tablizer (Score:1) Friday October 29 2004, @12:35PM
    • Re:I have a bit of a bone to pick. (Score:5, Insightful)

      by eln (21727) on Thursday October 28 2004, @05:35PM (#10658427)
      I've been programming perl for almost 10 years now. 2 years ago, I got a job where the entire codebase was in PHP. Because of my extensive knowledge of perl, I was able to pick up PHP good enough to become one of the top PHP coders on the team within about 2 weeks.

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

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

      By the way, saying you refuse to even look at another language because the language you use is so damn cool makes you a zealot, whether you want to admit it or not. Any good programmer should be willing to investigate and learn new languages. Nearly every language has its niche where it is better than any other language at doing whatever it does. With PHP, that niche is web applications.
      [ Parent ]
    • 3 replies beneath your current threshold.
  • What does it do differently? (Score:5, Interesting)

    by colin_n (50370) on Thursday October 28 2004, @04:38PM (#10657973)
    (http://topstartup.com/ | Last Journal: Wednesday November 24 2004, @01:35PM)
    PHP4 is to PHP5 as ASP is to ASP.NET? Is that statement correct? What advances does PHP5 make that puts it in direct competition with ASP.NET?
    • Re:What does it do differently? (Score:5, Insightful)

      by ptlis (772434) on Thursday October 28 2004, @04:41PM (#10657992)
      (http://ptlis.net/)
      It runs on something other than IIS...
      [ Parent ]
    • ASP.NET is infinitely better designed than classic ASP. (Not perfect by any means -- ASP.NET should be next to "leaky abstraction" in the dictionary -- but they got a LOT right this time around.)

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

      I would pick OpenACS [openacs.org] over ASP.NET but I would pick ASP.NET over PHP5 or most J2EE stacks.

      [ Parent ]
    • Re:What does it do differently? by colinramsay (Score:3) Thursday October 28 2004, @05:02PM
    • Re:What does it do differently? by Foofoobar (Score:2) Thursday October 28 2004, @05:08PM
    • Re:What does it do differently? by mojogojo (Score:1) Thursday October 28 2004, @06:18PM
    • Re:What does it do differently? (Score:5, Insightful)

      by Ogerman (136333) on Thursday October 28 2004, @08:39PM (#10659589)
      What advances does PHP5 make that puts it in direct competition with ASP.NET?

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

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

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

      http://www.extremeprogramming.org/rules/simple.h tm l
      http://www.springframework.org
      [ Parent ]
    • Re:What does it do differently? by jbplou (Score:1) Thursday October 28 2004, @10:14PM
    • 1 reply beneath your current threshold.
  • PHP vs Zope, Pearl vs Python (Score:5, Interesting)

    I had to use Perl for a project some time back. It was quick and dirty and did the job. At the same time I learned python without managing to apply it to the project. I recognized that I liked python better, but perl was faster to implement.

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

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

  • Back in my day... (Score:5, Insightful)

    by sleighb0y (141660) on Thursday October 28 2004, @04:45PM (#10658026)
    (http://www.code.cx/)
    We would learn PHP from the php.net documentation alone!

    And we liked it that way!
  • open-source vs. suitability to task (Score:2, Insightful)

    by Anonymous Coward on Thursday October 28 2004, @04:54PM (#10658098)
    As a programming language, it is particularly suited to web development projects, while being relatively easy to write, use and learn. More importantly, it's open-source...

    So, being open-source is more important than suitability to task?
    • Re:open-source vs. suitability to task by Anonymous Coward (Score:2) Thursday October 28 2004, @05:21PM
    • So, being open-source is more important than suitability to task?

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

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

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

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

      [ Parent ]
    • 1 reply beneath your current threshold.
  • by doombob (717921) on Thursday October 28 2004, @04:54PM (#10658106)
    (http://doombob.com/)
    Check out this one [amazon.com] as well. I got them both from the local library (amazing that they had them right away) and Beginning PHP5 was a more complete book. I still liked Learning PHP5, but I felt there were things left out. I know the review says that it doesn't go too deep, but I prefer the practical examples in Beginning PHP5.
    • 1 reply beneath your current threshold.
  • honest question here... (Score:4, Insightful)

    by EZmagz (538905) on Thursday October 28 2004, @04:55PM (#10658109)
    (http://www.blindwino.com/driver.html)
    With a language like PHP that has a very active developer community associated with it, why plop down for a book like this when websites like THIS ONE [php.net] exist and give all the documentation that you'd need when learning the language? I realize that it's handy in having a hardcover book to read (hell, I've got my fair share right next to my unemployed ass) and reference...but still.

    Just curious.

  • by Kenja (541830) on Thursday October 28 2004, @04:55PM (#10658110)
    The fastest way to learn PHP is to track down David Sklar and eat his brain, thus gaining all his knowledge and abilities.
    • No! by temojen (Score:2) Thursday October 28 2004, @05:26PM
    • 1 reply beneath your current threshold.
  • Shake a joystick... (Score:1, Funny)

    by Anonymous Coward on Thursday October 28 2004, @04:56PM (#10658115)
    There are more new books being published about PHP than you can shake a joystick at.

    Sure you can. I did it just last week. If you want proof, just look at the police report.
    • 1 reply beneath your current threshold.
  • I read it (Score:5, Informative)

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

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

    The book is not a 9...more like a 6. It's a professional paperback monolith and it doesnt spread disinformation. I don't know what's wrong with the reviewer *shrug* but this isn't a book I'd recommend.
    • Re:I read it by Jack9 (Score:2) Thursday October 28 2004, @04:59PM
    • So tell us... by AltGrendel (Score:2) Thursday October 28 2004, @06:35PM
    • Re:I read it by Zachary Kessin (Score:2) Friday October 29 2004, @12:08AM
  • php rocks (Score:1)

    by opweirdisntit (780341) on Thursday October 28 2004, @05:33PM (#10658414)
    i love php, ive been programming using php for at least 3 years now and no concerns. It rocks as a web dev language and there are so many cool things you can do with it! Even windows programming (GTK :))
    • 1 reply beneath your current threshold.
  • by MonkeyCookie (657433) on Thursday October 28 2004, @05:41PM (#10658478)
    What's with all the PHP book reviews recently? I seem to recall seeing three reviews within the last several months for various PHP books.

    They must be publishing these things like mad.
  • by Mr. Flibble (12943) on Thursday October 28 2004, @06:26PM (#10658806)
    (http://www.walford.ca/)
    I like this book, I picked it up the other week as my new job requires me to work with PHP. 90% of my prior work was all in bash with occasional touches of perl or C.

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

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

    Everyone has to start somewhere, and this book is geared to be easy from the start. I certanly don't feel like starting PHP by picking up the cookbook first. Will I read it? Sure - but not until I have finished the beginner books.
    • 1 reply beneath your current threshold.
  • I have the book! (Score:1)

    by InnerPhalanx (783564) on Thursday October 28 2004, @06:37PM (#10658890)
    Great book, I'm new to dynamic Website creation and the book presents information in such a way I or a more experienced person could both equally understand it. Each chapter has evaluation questions at the end. Good stuff, amazed it made it to /.! Also, the hawk on the book is cool too. =)
  • Job Lobby (Score:2, Insightful)

    by Line_Fault (247536) on Thursday October 28 2004, @07:15PM (#10659153)
    (http://www.burntmail.com/)
    I love PHP5! I've been running it since the first beta!
    Now if only I could find a job writing it!

    It seems most of the jobs here are ASP related mostly because Microsoft actively sells their product, there is no one selling Free alternatives.
  • php5 Host ? (Score:1, Informative)

    by Anonymous Coward on Thursday October 28 2004, @09:03PM (#10659706)
    We found a really good php5 host if anybody is looking. These guys seem to know their stuff.

    http://www.a2webhosting.com/ [a2webhosting.com]
  • by cloudkj (685320) on Thursday October 28 2004, @09:30PM (#10659826)
    You can save over $9 if you buy the book here [amazon.com]!
  • by mr.dreadful (758768) on Thursday October 28 2004, @11:04PM (#10660208)
    I was able to attend a "PHP Bootcamp", held by the nice folks at Big Nerd Ranch. David is an able teacher, and I would highly recommend the class to anyone looking to get a leg up on PHP. My only issue was that the book's answers to the chapter excercises were sometimes a bit more complex then they needed to be. More then just answering the question, David models good programming technique, which sometimes made finding the simple answer to "how do I do that?" a bit of a challenge. However, once the answer was determined, I find myself reviewing his coding structure more closely, making his book even more valuable. It might confuse the newbie, although anyone that sticks with it is probably better off for the expereince. David's also a co-author of the excellent "PHP Cookbook," whose other author wrote O'Reilly's "Upgrading to PHP 5." Frankly, I think all three should be bundled together in a "uber-set", as I found them to complement each other nicely. ("Upgrading to PHP5" has a very nice chapter on PHP and OOP) and no, I am not related to David... I really do enjoy these books!
  • ... At Big Nerd Ranch [bignerdranch.com], and it was awesome. If you like the book and you want more personal training, they're talking about doing this PHP5 bootcamp again in about 5 months. It's held at a fantastic retreat setting in georgia, so it's fairly free from distraction. If you've tried to find PHP training, you know this is an unserviced market largely, so if/when they offer this class again, jump on it fast.

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

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

    • 1 reply beneath your current threshold.
  • Learn PHP without a book (Score:1, Redundant)

    by kuzb (724081) on Friday October 29 2004, @02:15AM (#10661070)
    With all these books popping up people tend to forget that php's main site has a particularly comprehensive manual [php.net] that is also chock full of user contributed notes and code snippits. For the beginners, there is a good tutorial [php.net] there too.
  • More PHP suppliments (Score:3, Informative)

    by kuzb (724081) on Friday October 29 2004, @02:18AM (#10661079)
    For those interested, I wrote a PHP manual suppliment called phpbar [nullcreations.net] that works in your browser too.

    Yes, yes, it's a shameless plug, but I had a lot of fun putting it together ;)
  • Any good IDEs? (Score:2)

    by dioscaido (541037) on Friday October 29 2004, @05:02AM (#10661530)
    After developing in asp.net in visual studio, and jsp in eclipse, I couldn't imagine going back to the textpad days. What is available in terms of debuggers for php sites? Are we still depending on echo's?
  • Before the article appeared here :)

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

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

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

    The only thing I like about ASP.NET is threading (click a form, thread -> send an email = pretty fast) - Can ANYONE let me know if Threading is possible in PHP 5?
  • by DoubleSlashNick (824280) on Friday October 29 2004, @07:45AM (#10662057)
    (http://www.stadtaus.com/en/)
    Books are great in principle. But where is the meaning in paying for a commented PHP manual while beeing able to get this manual for free along with usefull comments on php.net?
    • 1 reply beneath your current threshold.
  • shaking joystick (Score:1)

    by lemody (588908) on Friday October 29 2004, @07:57AM (#10662118)
    "There are more new books being published about PHP than you can shake a joystick at."

    I wouldn't be so sure after a 1000m run in 'Track & Field 2'.
  • by OmahaVike (460189) on Friday October 29 2004, @08:09AM (#10662216)
    This book is not particularly useful for those experienced already with PHP, nor for those wanting to upgrade their knowledge of PHP from versions 4 and earlier to the newest version.

    okay, so can someone point me to some books intended on bringing an existing ver4 developer up to ver5?
  • Coming from a Perl background... (Score:2, Insightful)

    by ralphch (772571) on Friday October 29 2004, @08:15AM (#10662262)
    and having coded all my web applications in Perl, until recently, I decided to implement PHP on a fairly lightweight Bookfair system. I built it using a complete OOP framework and it's running amazingly well. As for the overbloated PHP design (twenty functions for the same thing), I hear you. All I can say is keep consistency in your code, limit yourself to a handful of functions. And hope, eventually, PHP will mature even further. Then again, it's mostly about 'how' you code rather than 'what' you use to code.
  • by edxwelch (600979) on Friday October 29 2004, @06:45PM (#10668845)
    I'd like to use PHP 5, unfortunately all ISPs seem to still be using PHP 4 (the server I wrote for reciently actually had 4.1)
  • Re:but (Score:1, Offtopic)

    by xoboots (683791) on Thursday October 28 2004, @04:56PM (#10658120)
    (Last Journal: Monday June 23 2003, @05:04AM)
    Is it my imagination or are the AC's even stupider than usual these days?
    [ Parent ]
    • Re:but by loginx (Score:1) Thursday October 28 2004, @07:59PM
  • Re:PHP or Perl? (Score:2, Interesting)

    by Flaming_cows (798162) on Thursday October 28 2004, @05:07PM (#10658209)
    Er, PHP stands for 'PHP: Hypertext Preproccessor' (gogo recursive acronyms!), not Personal Home Page.
    [ Parent ]
    • Re:PHP or Perl? by justMichael (Score:2) Thursday October 28 2004, @05:47PM
      • Re:PHP or Perl? by ScytheBlade1 (Score:1) Thursday October 28 2004, @06:32PM
  • Re:PHP or Perl? (Score:3, Insightful)

    by gentoo_moo (679483) <(gro.adamai) (ta) (leztec)> on Thursday October 28 2004, @05:09PM (#10658226)
    (http://www.iamada.org/)
    My first programming was in Perl. It was akward but fun. I switched to PHP about a year after I started Perl. I picked up the basics of PHP in about a week. Perl took me a bit longer (like a month for the fundamentals - but I was a real newbie too). Inside two weeks of geeking on PHP I'd written a service ticket program for my private consulting business, did some freelance web coding for another firm and wrote a small checkbook (quicken clone) to get used to it with MySQL.

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

    I think you'd probably pick up PHP pretty quickly. Others may say the same about Perl. This is just my humble opinion.
    [ Parent ]
    • 1 reply beneath your current threshold.
  • Re:Help is on the way... (Score:3, Informative)

    by GnuVince (623231) on Thursday October 28 2004, @05:31PM (#10658383)
    I agree! I recently started playing with Rails, and man it's the funnest thing to build web-based applications! It's easy, fun, simple (you have less code in your controller than some frameowkrs have just for their XML configuration files) and it works very well and very naturally!
    [ Parent ]
  • Perl will serve you online and off (Score:1, Insightful)

    by Anonymous Coward on Thursday October 28 2004, @05:37PM (#10658446)
    Perl does more than produce webpages via mod_perl. It is a powerful general purpose scripting language. PHP is not. PHP was built to spit out html and that is what it is good at.
    [ Parent ]
  • Re:PHP or Perl? (Score:3, Interesting)

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

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

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

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

    by phek (791955) on Thursday October 28 2004, @05:59PM (#10658614)
    Saying perl is 10x faster than PHP is really misleading. Bad PHP may be 10x slower than bad perl, but from my experience good PHP, is just about as fast as good Perl. The thing is PHP just try's to bring over so many functions from other languages, it can be really slow if your using something like the python derived functions. If you try to code PHP like you code C though, PHP tends to be around the same speed as Perl.
    [ Parent ]
  • Re:PHP or Perl? (Score:2, Insightful)

    by downward dog (634625) on Thursday October 28 2004, @07:43PM (#10659294)
    (http://www.slantwisedesign.com/)
    Are you really recommending C for web programming (which is 95% of PHP's use)? Unless you're writing Amazon.com, you will spend FAR too long programming and receive little perceivable benefit. PHP is perfect for most web programming; a shopping cart doesn't need to be uber-efficient. Few web apps peg the processor on their server. And if they do, it is not going to be PHP code that will do it -- it will be database or HTTP.

    Not saying that C isn't a great language for some things, but it is not a great language for rapid development of complex web applications. :)
    [ Parent ]
    • Re:Word Basher! by downward dog (Score:1) Thursday October 28 2004, @09:16PM
      • 1 reply beneath your current threshold.
    • 1 reply beneath your current threshold.
  • Re:PHP - poor design (Score:2, Funny)

    by drumsetdrummer (237047) on Thursday October 28 2004, @08:46PM (#10659620)
    Also consistently, people I talk to who use PHP after having used another language are universally scornful of PHP.

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

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

    Not to knock Perl -- I know that it has some quick 'n dirty, get the job done capabilities. But then so does PHP. And PHP looks and feels more like a real programming language.
    [ Parent ]
  • Re:PHP vs asp.net (Score:2)

    by LordLucless (582312) on Thursday October 28 2004, @11:08PM (#10660242)
    PHP 4 is comparable to ASP. From what I've heard (I haven't used it myself) PHP 5 is comparing itself to ASP.NET

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

    Also, there's a heck of a lot of community-contributed code. Something like PEAR is a great resource for extra functionality in your PHP scripts. I also find that there's more free documentation, tutorials and community-based support for PHP than there is for ASP.
    [ Parent ]
    • 1 reply beneath your current threshold.
  • Re:PHP - poor design (Score:3, Interesting)

    by LordLucless (582312) on Thursday October 28 2004, @11:15PM (#10660282)
    But to the point - PHP. When I am forced to use PHP for something, I am constantly amazed at the poor design and horrific bloat of the language. Case in point - there are no less than eleven different sort routines.

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

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

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

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

    by LordLucless (582312) on Friday October 29 2004, @03:13AM (#10661225)
    If you really want the ultimate in execution speed, efficiency and flexibility, code everything in assembler. If you see anything you like in a PHP script, simply re-invent the whole thing from scratch.

    If, on the other hand, you are not a masochist, you want to write something quickly and easily, something relatively easy to debug, something that isn't going to get multiple hits per second - use PHP. That's what it's there for.
    [ Parent ]
  • by The MESMERIC (766636) on Friday October 29 2004, @05:14AM (#10661572)
    (http://www.whitelightproduction.com/)
    dont compare languages - geez.
    each have their strengths and weaknesses.

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

    your generalization are pretty silly -
    [ Parent ]
  • by NardofDoom (821951) on Friday October 29 2004, @08:21AM (#10662299)
    I've programmed in Java, JSP, C++, and ColdFusion, and I still love php.

    So blah.

    [ Parent ]
  • by wtd (791730) on Friday October 29 2004, @02:50PM (#10666691)
    Either namespaces or comprehensively object-oriented data types and libraries would do the trick. Namespaces would be less spectacular, but still useful.

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

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

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

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

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

    Even better would be:

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

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

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

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