這份之前找到的 Perl VS PHP 的對照表,不過原始網站連不進去,幸好當初有另存下來. 先貼起來放著. 以防流失...
原始網站: Perl/Php Translation
其它參考可見: PHP in contrast to Perl
td { Font-family: helvetica,arial; } pre,xmp { Font-family: courIEr; } a { text-decoration:none; color: blue; Font-weight:bold; } a:hover { color: green; text-decoration:underline; } Perl/PHP Translation
arrays hashes data structures array split/join case conversion string comparisons functions
| string matching operations basename/dirname environment variables POST/GET parameters HTML elements URL encode MySQL database access
|
— Perl arrays — | — PHP arrays — |
---|---|
@a = (); | $a = array(); |
— Perl hashes — | — PHP hashes — |
---|---|
%h = (); | $h = array(); |
— Perl data structures — | — PHP data structures — |
---|---|
%h = ('a'=>13,'b'=>25); | $h = array('a'=>13,'b'=>25); |
— Perl array split/join — | — PHP array split/join — |
---|---|
@a = split( '|',$s ); | $a = preg_split( '/|/',$s, |
— Perl case conversion — | — PHP case conversion — |
---|---|
$s = lc($s); | $s = strtolower($s); |
— Perl string comparisons — | — PHP string comparisons — |
---|---|
$s1 eq $s2 | strcmp($s1,$s2) == 0 |
— Perl functions — | — PHP functions — |
---|---|
sub foo { | function foo() { |
— Perl string matching operations — | — PHP string matching operations — |
---|---|
$s =~ m/(w+)/; | preg_match( "/(w+)/",$match ); |
— Perl basename/dirname — | — PHP basename/dirname — |
---|---|
use file::Basename; |
|
— Perl environment variables — | — PHP environment variables — |
---|---|
%ENV | $_SERVER |
— Perl POST/GET parameters — | — PHP POST/GET parameters — |
---|---|
#form/hyperlink parameters: | #form/hyperlink parameters: |
— Perl HTML elements — | — PHP HTML elements — |
---|---|
use CGI (:standard); | # The Perl/CGI functions have the |
— Perl URL encode — | — PHP URL encode — |
---|---|
use URI::Escape; |
|
— Perl MysqL database access — | — PHP MysqL database access — |
---|---|
use DBI; | $dbh = MysqL_connect( 'localhost',$usr,$pwd);MysqL_query('USE test') MysqL_query( $sql_op ); $results = MysqL_query( $sql_op ); while($record = MysqL_fetch_row($results)){ .. } "'" . addslashes($val) . "'" |
以上是内存溢出为你收集整理的Perl VS PHP全部内容,希望文章能够帮你解决Perl VS PHP所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)