FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » What *tasks* are hard for PHP?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: What *tasks* are hard for PHP? [message #172040 is a reply to message #171956] Fri, 28 January 2011 05:16 Go to previous messageGo to previous message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma:
Member
"axtens" wrote in message
news:97691f21-90c5-42a6-8b63-76ae6154883d(at)d23g2000prj(dot)googlegroups(dot)com...

> I've asked this question on my blog. See
> < http://codeaholic.blogspot.com/2011/01/php-what-cant-or-wouldnt-you-do-in-p hp.html>.
> No flames required. No discussion about language semantics
> or implementation either (if at all possible). I just want to get an
> idea of what can and can't be done with PHP at the task level.

Most of the comparisons I've found are biased one way or another. Coming
from a background of relatively strongly typed languages such as Borland
Delphi and C, I have found both of these interpreted languages frustrating
and difficult to understand. Here are a few opinions:
http://www.thesitewizard.com/archive/phpvscgi.shtml
http://www.netconcepts.com/php-versus-perl/
http://shlang.com/php-perl-comparison.php
http://www.whenpenguinsattack.com/2006/08/08/php-vs-perl/
http://blogs.computerworld.com/15460/perl_vs_php_vs_ruby
http://www.wikivs.com/wiki/Perl_vs_PHP

It is handy to be able to include PHP within HTML. There are many sometimes
conflicting modules for Perl (such as DateTime). PHP does not seem to have
the equivalent of Strict, Warnings and Taint checking. And I found PHP file
I/O to be simpler (or more C-like):

Here is an example of straightforward and simple file I/O in PHP:
$fHTMLrawfile = "Raw.htm";
$fHTMLraw = fopen($fHTMLrawfile, 'r') or die("can't open file");
if (filesize($fHTMLrawfile) > 0)
$html = fread($fHTMLraw, filesize($fHTMLrawfile));
else
$html = 'N/A';
fclose($fHTMLraw);

A similar operation in Perl requires line by line iteration (or possibly a
lower level function, or reading into an array and then assembling the
string):
if (-e $HTMLpurefile){
open (fHTMLpure, '<', $HTMLpurefile);
my $line;
$in{$key} = "";
while( $line = <fHTMLpure> ){
$in{$key} .= $line;
}
close fHTMLpure; }

I now have a PHP script which is executed within my Perl script, but I might
consider rewriting the entire thing in PHP. Maybe it would be a good
learning experience to try a bit more than a trivial helper script in PHP,
and then I'll be able to make a more educated choice. At this point, I don't
really like either one. Maybe I should just do it in C!

Sorry if this is not exactly on topic or just presents the results of a
search, but I think it's helpful, at least for me, to have this information
on usenet.

Thanks,

Paul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sanitising input
Next Topic: php include question
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 15:08:44 GMT 2024

Total time taken to generate the page: 0.04033 seconds