Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

PHP primer for Perl hacker?

by Anonymous Monk
on Dec 15, 2004 at 19:24 UTC ( #415164=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Next month I'm going overseas to help a non-profit customize and install a rather large PHP/MySQL project. I really don't have much PHP experience at all, but have been using Perl and MySQL extensively for several years. Any recommendations of a good online primer or tutorial for Perl hackers trying to pick up PHP?


Replies are listed 'Best First'.
Re: PHP primer for Perl hacker?
by revdiablo (Prior) on Dec 15, 2004 at 21:26 UTC

    You might want to have a look at PHP in contrast to Perl. It takes a negative view towards PHP, which might be distractive in your case, but does have a number of useful comparisons. Keep in mind that I am not attempting to start an anti-PHP flame war; I think this page has some information that you may find useful when learning PHP after knowing Perl.

Re: PHP primer for Perl hacker?
by kvale (Monsignor) on Dec 15, 2004 at 20:29 UTC
    I am sorry to hear that :) I like the O'Reilly book "Programming PHP" by Rasmus Lerdorf and Kevin Tatroe. I think of it as analogous to the Camel book for PHP. Easy to read, has all the basics well explained. There is a chapter on databases, but not much on MySQL in particular. Once you know the basic language elements, however, that should be enough to start tweaking already written, working code.


Re: PHP primer for Perl hacker?
by amt (Monk) on Dec 15, 2004 at 20:41 UTC
    Picking up PHP from perl is a cakewalk, I had to do it for my job, but here are a few pointers.

    print is now echo, single vs. double quotes still applies, ALL variables are $foo, remember your <?php ?> tags for web pages, require is now include('file.php') if you want to organize your code, and checking /var/log/httpd/error_log is still very good ;)

    as for mysql: and is your friend.


      If you search at, you will see that PHP has both print and require functions. It's worth pointing out that PHP's require is different from Perl's in a number of ways (PHP's require is more similar to Perl's EXPR form of do), but PHP's include is even more different. The closest thing PHP has to Perl's require is probably require_once.

        A big difference between Perl and PHP is that a syntax error is not a fatal error (it just interrupts loading the current file), while a doubly defined function, is. And yes, in case you're wondering: in perl, it's exactly the opposite.
Re: PHP primer for Perl hacker?
by r34d0nl1 (Pilgrim) on Dec 15, 2004 at 19:57 UTC
    First: unfortunatelly there is no qq { } under PHP :( .
    anyway PHP is easy to learn and there is an extensive documentation under
    It's very well documented and nearly every function have an example.
Re: PHP primer for Perl hacker?
by StrebenMönch (Beadle) on Dec 15, 2004 at 19:57 UTC
    I do not mean to be harsh but Google is your friend...
    S t r e b e n M ö n c h
Re: PHP primer for Perl hacker?
by blueberryCoffee (Scribe) on Dec 16, 2004 at 10:02 UTC
    The best book I have found is PHP Developers Cookbook by Sams. This and the online docs is all you will need.
Re: PHP primer for Perl hacker?
by Mutant (Priest) on Dec 16, 2004 at 12:06 UTC
    It's very easy to learn PHP if you know Perl ... it's especially easy to learn to hate PHP :/

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://415164]
Approved by kutsu
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2020-09-18 13:50 GMT
Find Nodes?
    Voting Booth?
    If at first I don’t succeed, I …

    Results (112 votes). Check out past polls.