perl to php translation
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

perl to php translation

From: <alexjaquet@gmail.com>
Date: Mon Apr 17 2006 - 21:32:30 CEST

Hi,

I'm new to php and I'm trying to translate the following code :

sub loadPreferencesAuto {
        local our $content;
        open (FILE, "<$dir/preferences_auto.html") or die "cannot open file
$dir/preferences_auto.html";
        while (<FILE>) {
            s/\$LABEL{'([\w]+)'}/ exists $SERVER{$1} ? $SERVER{$1} : $1 /eg;
            s/\$LANG/$lang/g;
            s/\$ERROR{'([\w]+)'}//g;
            s/\$SESSIONID/$session_id/g;
            $content .= $_;
        }
        $content = Compress::Zlib::memGzip($content) if $can_do_gzip; ;
        print "Content-Length: ", length($content) , "\n";
        print "Content-Encoding: gzip\n" ;
        print "Content-Type: text/html\n\n";
        print $content;
        close (FILE);
}
Received on Mon May 1 02:58:13 2006