开发者

PHP 4 Compliance Checker

开发者 https://www.devze.com 2023-02-15 19:35 出处:网络
Is there a tool that checks your code and can feedback any PHP4 compliance issues? I\'ve just developed a Widget for WordPress and haven\'t used any PHP5.3 features but have used PHP5 features.

Is there a tool that checks your code and can feedback any PHP4 compliance issues? I've just developed a Widget for WordPress and haven't used any PHP5.3 features but have used PHP5 features.

I didn't realise the WordPress PHP version requirement was so low (PHP4.3) and am now contemplating the task of 'dumbing down' 开发者_JAVA百科the code to make it universally compatible.


You check your code with the PEAR Package PHP_CompatInfo. Quoting:

PHP_CompatInfo will parse a file/folder/script/array to find out the minimum version and extensions required for it to run. Features advanced debug output which shows which functions require which version and CLI output script

Basic Example:

require_once 'PHP/CompatInfo.php';
$source = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'math.php';
$info = new PHP_CompatInfo();
$info->parseFile($source);

Also see the User Guide for the PHP_CompatInfo


there is no problem using php 4 function , first check the version of php of your server using phpinfo() and if it is PHP 5.x then check that whether u r using any of below functions

see the deprecated function given below

Deprecated functions:

- call_user_method() (use call_user_func() instead)
- call_user_method_array() (use call_user_func_array() instead)
- define_syslog_variables()
- dl()
- ereg() (use preg_match() instead)
- ereg_replace() (use preg_replace() instead)
- eregi() (use preg_match() with the 'i' modifier instead)
- eregi_replace() (use preg_replace() with the 'i' modifier instead)
- set_magic_quotes_runtime() and its alias, magic_quotes_runtime()
- session_register() (use the $_SESSION superglobal instead)
- session_unregister() (use the $_SESSION superglobal instead)
- session_is_registered() (use the $_SESSION superglobal instead)
- set_socket_blocking() (use stream_set_blocking() instead)
- split() (use preg_split() instead)
- spliti() (use preg_split() with the 'i' modifier instead)
- sql_regcase()
- mysql_db_query() (use mysql_select_db() and mysql_query() instead)
- mysql_escape_string() (use mysql_real_escape_string() instead)
- Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
The is_dst parameter to mktime(). Use the new timezone handling functions instead.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号