PHP代码版本依赖 [英] PHP code version dependency

查看:148
本文介绍了PHP代码版本依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在php的每个版本中,添加了一些新功能,并且某些功能被停止。

In each and every version of php, some new features are added and some features are stopped.

示例:

<?php
$hex = hex2bin("6578616d706c65206865782064617461");
var_dump($hex);
?>

将需要php 5.4.0及以上版本,因为hex2bin是在php 5.4.0中引入的。 >
在php.net中手动检查版本依赖关系,对于php代码中使用的每个内置函数来说都是乏味的。是否有任何自动/半自动的方式来确定执行任何给定PHP代码的php安装的最小版本(最大版本(如果适用))?

will need php 5.4.0 and above, as hex2bin was introduced in php 5.4.0.
It is tedious to check version dependency manually in php.net for each and every built-in functions used in php code. Is there any automated/semi-automated way to identify the minimum version (and maximum version if applicable) of php installation would be needed to execute any given php code?

推荐答案

查看PHPCompatibility项目: https://github.com/wimg/PHPCcompatibility
这测试您的代码与5.2,5.3,5.4和5.5(写作时的alpha2)的兼容性

Check out the PHPCompatibility project : https://github.com/wimg/PHPCompatibility This tests your code for compatibility with 5.2, 5.3, 5.4 and 5.5(alpha2 at the time of writing)

这篇关于PHP代码版本依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆