44 Comments
- merr, on 10/12/2007, -6/+20...and inconsistent namespaces. I use array_rand() to retrieve a random element from the array, so how do i count the elements in the array? Is it array_count()? Nope... count().
That and it's lame attempt at object-orientedness and complete lack of meta-programming capabilities make PHP kind of an obnoxious language, IMO. - Snowcone, on 10/12/2007, -1/+8I know both PHP and Perl and there is no way that PHP is as flexible and robust as Perl. Did I mention that I am a full time PHP developer? PHP has a large user base because of its ease of use, but there is no arguing that the aforementioned drawbacks are there (inconsistent namespaces and magic quotes being the bane of my existence).
- tomarocco, on 10/12/2007, -0/+6PHP makes easy things easier than Perl.
Perl makes hard things PHP can't do easy.
Perl also makes a good chunk of Linux/Unix tick, even though you don't see it.
If you know Perl, learning PHP is child's play. The reverse is not so true. - merr, on 10/12/2007, -0/+5http://www.php.net/manual/en/funcref.php
For me, this is better because it breaks down all the functions by category. Of course, I haven't written a line of PHP in >2 years. - scratched, on 10/12/2007, -0/+5Perl has been updating itself with the times. It used to be only possible to use with CGI, now there is an apache mod for it so you can use it (almost) like php in a sense. Perl has also added objects (though I don't know how good they are in Perl) which is a major trend in modern programming languages.
To go more back on topic, I'd like a way to convert php scripts to perl. I just recently started learning perl and want to try to convert my website to Perl as a learning project but I wouldn't know where to start. PHP is related to perl in a lot of syntactical ways, but it is also very different in so many ways that you can't do a quick translation. It'll take me a while before I learn enough Perl to convert my PHP code into perl. - LiquidPenguin, on 10/12/2007, -6/+11More functions does not always make for a better language. I tend to shy away from PHP with most of my solutions for precisely that reason. With so much time spent towards building such a huge function library, the PHP developers ignored syntactic standards. It's true that most languages have their off-the-cuff-WTF-is-that-doing-in-there functions, PHP has a larger percentage of them. During code audits, not using appropriate functions and piss-poor query handling are at the top of the list of mistakes.
And I will never, ever, forgive a language that single handedly introduced Magic Quotes Hell as a default. I'd rather suffer life with malboge than that Hell. - bguthro, on 10/12/2007, -4/+9why?
- coditza, on 10/12/2007, -2/+6$_SERVER['argv']
But, why would someone want to "convert" one script from perl to php? Lazyness? This is not the answer, because if you were lazzy, then you would let the damn script alone. Also, even if you would like/love/know better php than perl, then you would rewrite the whole thing, not "convert" it. That article is pointless.
Btw, from all the guys I know that are good in both php and perl, there is none that will say one of them is better than the other. It seems the perl fanboys were faster, let's sit back and watch the php fanboys counter attack ;) - jgtg32a, on 10/12/2007, -0/+3@PleaseJustDie
not really, what I do know is that PERL was designed w/ RegEx
I do know is that a good number of languages added them but do not get the same efficiency as PERL does
they use them because they are easy to use once you figure them out - mattsidesinger, on 10/12/2007, -1/+4There is also PLEAC (http://pleac.sourceforge.net/) for those of you that have the Perl Cookbook.
- bparker, on 10/12/2007, -0/+3@ scratched
I'll be glad to help you out with perl. - jftuga, on 10/12/2007, -0/+3On a FLOSS Weekly episode, Rasmus Lerdorf jokingly said the PHP stood for, People Hate Perl. :-)
- drewhenson, on 10/12/2007, -0/+3The real value of this, for me anyway, is that it has lots and lots of PHP functions, all in a list. All I need to do is hit search to make sure if I'm using the correct function, or the function correctly.
- Snowcone, on 10/12/2007, -1/+4Doesn't even have to be to PHP, just convert it to something that doesn't suck.
- InfamousX241, on 10/12/2007, -3/+5Aw man, when I read the title I thought there was some script to convert whole PHP files to Perl. Kind of improbable though, since PHP has like 50 times more built-in functions :P
- nevetS, on 10/12/2007, -0/+2It takes a while longer to learn the ins and outs of Perl vs. PHP, but it is an extremely powerful language. It's not going away anytime soon. I think lighttpd + fastcgi is the way to go in the web world, but that's just my opinion. It's much easier to deal with than mod_perl for apache.
There is good reason to convert code both ways. I haven't seen much evidence of people using php for command line scripts, but the possibility is there. The PEAR repository maps all right to CPAN, but it's nowhere near as robust, and a lot of php users don't even know what PEAR is to begin with. - scratched, on 10/12/2007, -0/+2I actually did go and buy Learning Perl and I'm reading it now. I like the language so far, though I haven't gotten very deep into it. I've known it could do more than CGI and mod_perl. I actually became interested in learning it because of its system admin applications since I'm also a linux enthusiast.
My first language was C++ which got me into the habit of using objects whenever possible. I haven't bothered to look into OOPerl yet since I just started and still want to get the hang of the syntax before I start learning how to use objects. I just started learning objects with PHP but I find the implementation to be a bit of a pain to learn. I'm hoping when I learn OOP it is easier to pick up on than PHP (as in closer to how C++ & C# work) - VenTatsu, on 10/12/2007, -0/+2@coditza
$_SERVER['argv'] does not even get close to comparing with Getopt::Std or any of it's sibling modules (my preference is Getopt::Long).
PHP has it's strong points, out of the box it's easy to get a simple web application back by a database up and running. Perl takes more work to get to that point, however it excels at a far wider range of application domains. If you ask web programmers which is better you might get an even split, but try asking system programmers, system administrators, or data processing programmers, in those fields your not likely to see many PHP fans. - altintx, on 10/12/2007, -0/+2Similar resources:
http://www.cs.tufts.edu/comp/20/notes/php_perl.php
http://www.alternateinterior.com/2006/10/php-and-perl-comparison.html - nougat98, on 10/12/2007, -0/+2I use Getopt::Std a lot. How do I pass command-line arguments like that using PHP?
- randomguru, on 10/12/2007, -0/+1"If you know Perl, learning PHP is child's play. The reverse is not so true."
totally agree with that. - dbr_onix, on 10/12/2007, -0/+1Why? Because both languages have their uses. PHP is largely intended for websites, Perl is better for command-line applications. Things like this list will make it easier for someone who, say, knows Perl and wants to learn PHP, or vise versa.. Not quite sure why you'd ever want to convert a script from Perl to PHP (I can maybe see PHP to Perl, since there is a lot of fairly specific modules, say, WWW::TV which phrases www.tv.com, which could be fairly complicated to do in PHP)
- Ben - Stonekeeper, on 10/12/2007, -1/+2Cool! I've heard of code obfuscators, but not code de-obfuscators!
- bairy, on 10/12/2007, -0/+1The description says "A great guide for converting your perl scripts to php and vice-versa."
Did "guide" not give it away? - TechTraction, on 10/12/2007, -0/+0Nice side by side comparison of general how-to between Perl and PHP. From first glance it looks to be useful if your coming from a Perl background (like myself) and starting to work with PHP. I'll be referring to this page and some of the other suggested resources in these comments in the near future.
- GrayTapMedia, on 10/12/2007, -0/+0this has been on the net since "for ever" when YaBB use converted for YaBB SE I used this page as CliffsNotes in a way!
if this is not the original site it's a ripoff of a much older page! - PleaseJustDie, on 10/12/2007, -0/+0@jgtg32a
PHP has 2 ways to do regular expressions, one runs them through the pearl regular expression parsing routines the other runs them through a scripted routine so you can use pearl syntax and maintain the same speed of pearl from PHP. - DrGamez, on 10/12/2007, -1/+1WHY
- cyn0sure, on 10/12/2007, -3/+3OMG eew why?
- coditza, on 10/12/2007, -1/+1@VenTatsu: I have no idea about everything that Getopt::xxx does, but I bet if PHP was developed with shell scripting in mind, there would be something equivalent. There is a pear extension that deals with the cmd line args, but again, I don't know exactly what Getopt::xxx does, so I can't say that's the equivalent.
Most system programmers, system administrators, or data processing programmers prefer perl, because they know it better. I am myself a system and network admin, I also did some data processing tasks, but I used php, because I know it better. I find it stupid to give away a perfect tool for a job, that you already know how to use, just because some stupid reasons.
No ruby fanboys around yet? - jgtg32a, on 10/12/2007, -2/+2@Bguthro
beat me to it.
This looks like a guide to learn the other and not some program that does it for you.
I don't know that much about PHP, but I'm willing to bet it doesn't do text as well as PERL
But hey I know PERL and not PHP - inactive, on 10/12/2007, -2/+1Damn useful post that ever read on digg.
- yogastore, on 06/30/2008, -1/+0http://astore.amazon.com/flowtron.mosquito-20
http://astore.amazon.com/flowtron.insect.killer-20
http://astore.amazon.com/evaporative.air.cooler-20
http://astore.amazon.com/air.swamp.cooler-20
http://astore.amazon.com/braun.electric.kettle-20
http://astore.amazon.com/cordless.electric.kettle- ...
http://astore.amazon.com/canon.battery.charger-20
http://astore.amazon.com/12.volt.battery.charger-2 ...
http://astore.amazon.com/furniture.chaise.lounge-2 ...
http://astore.amazon.com/outdoor.chaise.lounge-20 - harmonic, on 10/12/2007, -4/+1someone needs to get to work on converting that slowass Webmin service to php
- manitoba98xp, on 10/12/2007, -6/+3Wow, didn't realize we had so many Perl fans on Digg. I think Perl is getting outdated, though I don't think PHP is a huge improvement in functionality, it is much cleaner. I'm also shocked that nobody has mentioned Ruby on Rails yet....well, now I guess I have. :P
- inactive, on 10/12/2007, -5/+2Yes, I'd like to know the use of that too. I'm new to programming. I'm gonna get buried me thinks.
- LiquidPenguin, on 10/12/2007, -8/+3@ merr
Crap, sorry, I meant to digg you UP.
I need more coffee. - rip747, on 10/12/2007, -8/+3buried as inaccurate.
the title suggests a script that will perform this conversion automatically. all this is is a side by side comparisons of the two languages. - inactive, on 10/12/2007, -7/+1GOOD. Because Perl is *****.
- scooba, on 10/12/2007, -11/+5Who cares? This is similar to trading in a Swiss-army-knife for an ice picker.
- PleaseJustDie, on 10/12/2007, -10/+2I do PHP and not Pearl and there is no way Pearl can handle text as well as PHP.
See how stupid that sounds now? - Walli, on 10/12/2007, -10/+1And what do these comments have to do with the article?
4 Thumbs down for the provocation...


What is Digg?
Browsing Digg on your phone just got easier with our enhancements to the