Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Caveat: I'm a PHP developer for Zend, and a lead author on several PHP open source projects. I'm also a perl developer. I use both languages regularly, though PHP more often than perl in recent years, due to the nature of my places of employment. I'm going to refute some points about PHP below, based on my experience with the language.

From what I understand, similar things are available in PHP as well

Yes, they are, including a PHP port of Cgiapp (that's a shameless plug), the Smarty templating language, the Savant templating language, and many others. In fact, regarding templating languages, PHP, in Rasmus Lerdorf's own words, was meant to be a templating language (Savant takes that approach, actually).

There are number of frameworks similar in nature to Catalyst and CGI::Application out there for PHP as well -- Solar, Symfony, Cerebral Cortex, and Seagull, to name a few.

PHP does not have the breadth of coverage that CPAN does

This is debatable. The difference between PHP and Perl is that Perl has CPAN as a common repository. PHP has PEAR, but PEAR doesn't have quite the extensive library CPAN does. However, it does have some pretty rigid guidelines for contribution, one of which is that it (in recent years) allows duplication of packages only when the approach significantly differs, leading to what is hoped as 'best-in-breed' packages. Additionally, there are a number of other sites that are aggregating packages out there, including phpclasses. I'm betting that the number of PHP libraries out there is similar to perl's -- if in fact it hasn't exceeded perl's at this point.

However, a key difference to note is that PHP is primarily targeted at web development. So the breadth and scope of packages for PHP is going to be significantly different than that for Perl.

The main reason I avoid PHP though is the myriad security problems, lack of a consistent database interface, the habit of having a million functions in the main namespace with no particular naming convention or consistency, and the rather strange nature of PHP data types which allow you to mix hashes and ordered lists in a single structure.

To this I reply:

  • There are security problems in just about every language; perl is not immune to this. Most security problems seen recently have less to do with the language itself as with bad programming practices (e.g., phpBB).
  • PHP is addressing the "consistent database interface" issue with the PDO library, which is due for PHP 5.1 (and has been backported to the 5.0.x series).
  • I agree with the "million function in the main namespace" comment; this is very frustrating for a PHP developer. However, many of these functions are very narrow and targetted in scope -- and correct usage of them can greatly optimize a script.
  • I like the mixing of hashes and arrays. This actually makes many types of operations easier, to my thinking. It is merely different from perl, not necessarily a disadvantage.

As for the OP, what it comes down to is: does it make good business sense for you to learn PHP at this time? If the project has a narrow deadline, and it's known that there will be Perl developers in your company for the forseeable future, it may not make sense; you're more familiar with perl and its libraries, and you'll be able to maintain the site more easily as you won't need to 'switch modes' between the two languages.

However, your boss may have some particular ideas for why s/he wants PHP: cheaper, more plentiful developer base (though that may change); easier to find hosting should s/he decide to outsource the hosting (I see PHP on more shared hosts than perl); perhaps some business partnerships that would involve exchanging APIs and code.

Do more research before you make your decision; but don't believe all FUD you hear about either language.


In reply to Re^2: perl vs. php by weierophinney
in thread perl vs. php by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-03-19 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found