Can a Perl Programmer Pick up PHP quickly?

M

Mike

I have a lot of experience with Perl and a good paying job has come up
that requires someone to update and maintain a website written in PHP.

Can a Perl programmer pick up PHP easily? Are there similarities?


Thanks
 
J

John Bokma

I have a lot of experience with Perl and a good paying job has come up
that requires someone to update and maintain a website written in PHP.

Can a Perl programmer pick up PHP easily?

Depends a lot on your programming skills. But even then, learning a new
language takes time.
Are there similarities?

Yes, but that is more of a huge disadvantage, since some things are almost
the same, note the almost.

But again, it depends on how much "a lot of" is, and how deep you are into
Perl. If you hate PHP from the start, en complain for hours about it, you
have a lot of experience with Perl :-D.

If you, on the other hand, pick up PHP in a few days, I don't want to see
any of your Perl coding (j/k).

IMO, the best way to learn a language is to pick up a good book, and read
it at least twice front to back, before you turn on the computer.

IMNSHO the worst way to "learn" a language is firing up your editor and
copy paste snippets one finds online, in the documentation, and books,
until it works (sort of).
 
C

Charlton Wilbur

M> I have a lot of experience with Perl and a good paying job has
M> come up that requires someone to update and maintain a website
M> written in PHP.

M> Can a Perl programmer pick up PHP easily? Are there
M> similarities?

I worked in PHP for a contract job. I found the job interesting, but
PHP frustrating, because of the similarities. A lot of features in
PHP seem to have been implemented because it was a neat feature in
Perl or C++, but without any real thought as to why the feature works
as it does in Perl or C++. This also contributes a great deal to the
proliferation of builtins.

As an example: hashes and arrays are the same thing in PHP, and
there's no concept of a code block. (Callbacks require defined
functions, and don't work cleanly if you mix them with OO.) So one
function in Perl, sort, handles everything. In PHP, the array-hash
equivalence that seemed like such a nice idea and the fact that you
can't simply pass in a code block to determine how to sort things mean
that there's an enormous proliferation of functions that sort.

It's also a lot more difficult to fix the problem; in Objective-C I
was annoyed by the lack of foreach/map/grep, and so I wrote something
to hook into the runtime and fix it. In PHP I was annoyed by the lack
of AUTOLOAD, and the only thing I could do was upgrade to the latest
version, which was untenable without heavy testing.

But a good programmer should have no problem picking up PHP.

Charlton
 
D

Derek Fountain

Mike said:
I have a lot of experience with Perl and a good paying job has come up
that requires someone to update and maintain a website written in PHP.

Can a Perl programmer pick up PHP easily? Are there similarities?

PHP should present no problems to an experienced Perl guy. What does
take some learning is the integration with the web server, http, and
other technologies. If you can't, for example, explain in some detail
how a session cookie works, and what security implications you might
want to consider for an application of one, you might struggle with even
a modest PHP program.

You may have some relevant Perl experience, depending on what you've
been doing with Perl, but don't assume that because the language looks
fairly simple to pick up that you'll know how to implement robust
solutions with it.
 
M

Matija Papec

X-Ftn-To: Mike

I have a lot of experience with Perl and a good paying job has come up
that requires someone to update and maintain a website written in PHP.

Can a Perl programmer pick up PHP easily? Are there similarities?

It is almost like perl but without map, grep[1], anonymous functions, real
references and namespaces. :) In turn it offers great deal of core functions
but I wouldn't consider that as an advantage.


[1] you can implement your own basic "poor man map" if you're really
desperate
 
A

Average_Joe

I have a lot of experience with Perl and a good paying job has come up
that requires someone to update and maintain a website written in PHP.

Can a Perl programmer pick up PHP easily? Are there similarities?

You can probably pick up PHP just by sitting down with it for an evening.

It's very easy, some would say "easier" than perl. (note that "easier" !=
"better")

PHP is kind of like a bleached perl. All the color has been drained out
and you're stuck with a rather boring environment. The "boringness" is
what makes it easier. The boringness is what takes all the fun out of it.

On the bright side, it has all kinds of web-specific stuff built in. It is very
much a language for web development. Much of the documentation will mention
differences between perl.

It has some warts though, the worst being that it's different on each host
with different features enabled, bleh bleh.. You can never really be sure
what you work on will run on another host.

Also, if you're familiar with mode_perl, it'll drive you crazy that you can't
cache expensive objects / data structures the way you can in mod_perl.

Jamie
 
J

John Bokma

Average_Joe said:
You can probably pick up PHP just by sitting down with it for an
evening.

*sniggers* Only if you have little understanding of Perl and little
understanding of PHP is required.
It's very easy, some would say "easier" than perl. (note that "easier"
!= "better")

And some would say much harder than Perl especially with a solid Perl
background.

If there was such a thing as an easy programming language it would have
been invented 40 years ago.
 
A

axel

*sniggers* Only if you have little understanding of Perl and little
understanding of PHP is required.

It really depends on what you want to do with it. If it just a
question of picking up some data from a database and displaying it
on a website, then it is very straight forward.

I cannot comment on more complicated matters as I do not consider
what is a fundamentally webprogramming language something I would
use for other purposes.

Axel
 
M

Matija Papec

X-Ftn-To: (e-mail address removed)

It really depends on what you want to do with it. If it just a
question of picking up some data from a database and displaying it
on a website, then it is very straight forward.

It is, but you can soon find struggling with php if you want to do something
more => http://tnx.nl/php
 
A

axel

Matija Papec said:
X-Ftn-To: (e-mail address removed)
It is, but you can soon find struggling with php if you want to do something
more => http://tnx.nl/php

Thanks...an interesting webpage. I have no desire to do much
with PHP... I just have to sometimes, normally just connecting
with MySQL or Oracle... I need to pay my Amazon book bills :)

Axel
 
J

John Bokma

It really depends on what you want to do with it. If it just a
question of picking up some data from a database and displaying it
on a website, then it is very straight forward.

Yup, little understanding of PHP. Although pìcking up some data leaves
enough room to create huge security issues.
 
M

Mladen Gogala

It is, but you can soon find struggling with php if you want to do something
more => http://tnx.nl/php

Ah, another PHP hater, and a countryman at that. No, no struggling is
necessary. PHP is easier to learn then perl. Much easier to learn. On the
other hand, for the CLI environment, perl rulz. I started with perl few
weeks ago, when subroutines were called with "&" and curent version was
perl 4.0.36. As an oracle DBA, I used oraperl variety, a predecessor to
DBI/DBD::Oracle. It was 1995. PHP5 was a breeze to pick: no @ISA, no
$AUTOLOAD, no tie, no hidden first arguments, just classes, methods and
inheritance, the way they're meant to be. Yes, PHP5 uses functions for
everything and you can't write something like

if (/^Gas:(\d+).*Mileage:(\d+).*Toll:(\d+)/) { my $expense=$1+$2+$3; }

or use tricky idioms like

$a ||= 'A';

PHP functions are, on the other hand, well documented, books are complete,
unlike "Learning Perl", which skips things like references, packages and
objects. To learn Perl, you need at least 3 books: "Learning Perl",
"Programming Perl" and Conway's OO Perl. It is much easier to learn PHP
then to learn Perl. On the other hands, Perl has formats, and PHP has
nothing like a built-in report writer. I love both Perl and PHP, PHP for
the web, Perl for CLI. Perl with its arcane secrets and tricks that can be
learned only through the word of mouth and bizarre mechanisms like "tie"
is much, much harder to learn. This comes from someone who uses both perl
and PHP. That page is rubbish. For the real PHP hater page look for the
PHP emulation modules on CPAN.
 
J

John Bokma

Mladen Gogala said:
Ah, another PHP hater, and a countryman at that. No, no struggling is
necessary. PHP is easier to learn then perl.

Nonsense. Another Perl hater.
Much easier to learn.

Only if you are interested in 20 line PHP thingies.
On
the other hand, for the CLI environment, perl rulz. I started with
perl few weeks ago, when subroutines were called with "&" and curent
version was perl 4.0.36.

Which is like, eh... 15 years old?
As an oracle DBA, I used oraperl variety, a
predecessor to DBI/DBD::Oracle. It was 1995. PHP5 was a breeze to
pick:

in 1995?
no @ISA, no $AUTOLOAD, no tie, no hidden first arguments,

which hidden first arguments?

btw: check out:

use base CLASS

Wrt $AUTOLOAD: maybe rtfm, and it becomes clear how useful it is. You
*don't* have to use it, but it makes life easier.
just
classes, methods and inheritance, the way they're meant to be.

*sniggers* you are talking about PHP now are you?
PHP functions are, on the other hand, well documented,

*sniggers*, sure. Maybe you misunderstand the word well.
secrets and tricks that can be learned only through the word of mouth
and bizarre mechanisms like "tie" is much, much harder to learn.

What is bizarre about tie? Which part do you not understand? It's
nothing more then being able to override some methods on a type of
variable.
This
comes from someone who uses both perl and PHP. That page is rubbish.

You mean, you don't have a clue what it tries to make clear.
 
J

John Bokma

Mladen Gogala said:
Actually, I love Perl and I use it quite frequently.
I also happen to love PHP.

But your Perl knowledge and PHP knowledge are severly limited.
 
J

John Bokma

Used to be you'd call a sub like this &subroutine() which is how I
learned it.

Then you didn't learn enough. You still set register globals to on?
The whole 'more than one way to do it' is nice, but it does make perl
harder to learn.

Nonsense. PHP is not easier compared to Perl. If you do serious things
in PHP you have to learn a lot. The thing is, most people use PHP for
small toy thingies.
For a Perl coder, PHP is simply a matter of sitting down and writing.
(and probably hating it because of the way it hampers ones sense of
creativity)

It's not. I am an experienced Perl coder, and it's not a simple matter
to do PHP. To process a form and put a few things in a database, yes. To
write a serious big application no.
PHP has something-to-the-effect-of classes. No real name spaces
though.

One of the major flaws, yes.
Seems to me, PHP5 is looking up toward 'java'. Has interfaces and all
that jazz. (still no inner classes though)

It's not even close to Java of 1995.
While perl has had 'die' for years, PHP only recently picked up
exceptions.

Yup, PHP has been designed by people with a severe lack of computer
science skills.
Naturally, a language with fewer features is going to be easier to
learn. (and probably parse much faster too)

If there was an easy to learn programming language it would have been in
use for over 50 years by now. So why isn't there such a language?
Remember Java? Easier and "smarter" then C++. No more memory leaks
(sure), write once, run everywhere (sure). And have a peek at Java now.

Languages that start out as easier then X, better, faster to learn, etc.
often miss out a lot of features which are added in, sometimes extremely
clumsy. PHP already started out clumsy, so imagine.
PHP is pretty well documented.

It isn't.
I don't think it's as documented as
perl though.

Exactly. You can't call documentation guessed after the source not good
documentation. Add the so called User Notes (a large part has little or
no programming skills) and you are in for a wild ride.
Problem with perl is it's *too well* documented.

No it isn't. It's very well, and *formal* documented. I don't have any
doubt if I look up something in the Perl documentation. I do have doubts
when I read the PHP "documentation". And I have guess the rest based on
experimentation. Which means that when I upgrade to a new version my
program might break (been there, done that).
tie is rather hackish,

It isn't. It's just like being able to override methods on a basic type
in Perl, nothing more, nothing less.
you can admit it, I won't say anything.
(hackish and quite useful at times.)

BTW, speaking of 'tie' and undocumented.. PHP also has stuff like
'tie' but they don't call it as such. It's the kind of thing that is
very hard to learn about compared to perl because it isn't as well
documented as perl is. (they call it 'spl' or some-such, the idea
being to implement a standard interface) Trying to learn about it is
rather tough because you have to know what to look for. I suspect perl
is easier to learn in that regard at least.

Again, there are no easy languages. PHP seems to have it origins in a
programmer who had little to no Perl skills, thought he could make an
easier "Perl" and ended up with a bigger mess. Sadly there are still
people adding to this mess instead of weeding out all the garbage that
has been crept into PHP.
 
A

axel

John Bokma said:
Again, there are no easy languages. PHP seems to have it origins in a
programmer who had little to no Perl skills, thought he could make an
easier "Perl" and ended up with a bigger mess. Sadly there are still
people adding to this mess instead of weeding out all the garbage that
has been crept into PHP.

I remember using one of the earliest versions of PHP years ago...
it was basically only a means of adding a counter and similar
things to web pages. Obviously it has grown since then but
with no overall plan except adding new features.

Axel
 
R

rich

I have a lot of experience with Perl and a good paying job has come up
that requires someone to update and maintain a website written in PHP.

Can a Perl programmer pick up PHP easily? Are there similarities?


Thanks

I started off using Perl and had to pick up PHP along the way for a couple of
work projects. Perl has a lot more uses, but with regard to the same application
(web site development, accessing SQL databases, etc.) they're pretty close. Have
to get use to using functions instead of subroutines but a little practice goes
a long way. With Perl, I got into the habit of using "strict" and took some time
getting use to not having it available.

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top