note Juerd <p><blockquote><em> I'll point out that moving from Perl to PHP is *very* easy. </em></blockquote></p> <p> Is it really? Perhaps you are right for simple web based stuff like a mail form, a simple database driven site or just templating. However, real programming isn't translated to PHP so easily. </p> <p> First of all, what are you going to do with namespaces? PHP <em>still</em> does not have namespaces. </p> <p> Then, what will you do with closures? PHP has no closures. Heck, it doesn't even have anonymous functions. That's another thing: how will you be rewriting that hash of coderefs? A hash of strings that are <tt>eval</tt>ed at runtime? </p> <p> And what about all those objects that aren't simple hashes? </p> <p> But let's assume you didn't use any of these slightly more advanced programming techniques than the average PHP "programmer" can handle. But you did use modules. You do use modules, don't you? </p> <p> PHP is a web programming language, so it must have a good HTML parser ready, right? One is available, but it cannot be called good. It cannot even parse processing instructions like, ehm, <code><?php ...?></code> itself. </p> <p> Another common task in web programming is sending HTML mail with a few inline images. So what alternative for MIME::Lite do you have? The PHP-ish solution is to build the message manually. Good luck, and have fun. </p> <p> But at least it can open files over HTTP. Yes, that it can. But what do you do if you want more than that? What if you want to provide POST content, headers, or implement ETags? Then, you must use Curl, which isn't nearly as convenient as LWP. Don't even think about having something like WWW::Mechanize in PHP. </p> <p> Enough with the modules. I think I've proven my point that CPAN makes Perl strong. Now let's discuss the core. In fact, let's focus on something extremely elementary in programming: arrays! </p> <p> PHP's "arrays" are hashes. It <em>does not have</em> arrays in the sense that most languages have them. You can't just translate <code>$foo[4] = 4; $foo[2] = 2; foreach $element (@foo) { print $element }</code> to <code>$foo[4] = 4; $foo[2] = 2; foreach ($foo as $element) { print $element }</code>. The Perl version prints 24, PHP insists on 42. Yes, there is <tt>ksort()</tt>, but that isn't something you can <em>guess</em>. It requires very in-depth knowledge of PHP. And that's the one thing PHP's documentation tries to avoid :) </p> <p> Also, don't think <code>$foo = bar() || $baz</code> does the same in PHP. In PHP, you end up with <tt>true</tt> or <tt>false</tt>. So you must write it in two separate expressions. </p> <p> Exactly what makes you think and even say moving from Perl to PHP is easy? It's very, very hard to un-learn concise programming and go back to medieval programming times. And converting existing code is even harder. </p> <div class="pmsig"><div class="pmsig-132236"> <p><font color="#800000"> Juerd # { site => '<a href="" target="_blank"><font color="#800000"></font></a>', plp_site => '<a href="" target="_blank"><font color="#800000"></font></a>', do_not_use => '<a href="" target="_blank"><font color="#800000">spamtrap</font></a>' } </font></p> </div></div> 421963 422001