Home > Backend Development > PHP Problem > Differences between php versions

Differences between php versions

王林
Release: 2023-02-26 08:40:01
Original
4577 people have browsed it

Differences between php versions

1. Comparison of differences between PHP 5.2, 5.3, 5.4, 5.5, 5.6 versions and detailed explanation of new features

PHP5.2 以前:autoload, PDO 和 MySQLi, 类型约束
PHP5.2:JSON 支持
PHP5.3:弃用的功能,匿名函数,新增魔术方法,命名空间,后期静态绑定,Heredoc 和 Nowdoc, const, 三元运算符,Phar
PHP5.4:Short Open Tag, 数组简写形式,Traits, 内置 Web 服务器,细节修改
PHP5.5:yield, list() 用于 foreach, 细节修改
PHP5.6: 常量增强,可变函数参数,命名空间增强
Copy after login

2. PHP7 New features

./bin/php -v  #查看PHP版本
./bin/php -m  #查看安装的模块
Copy after login

1. Variable type

function test(int $a,string $b,array $c):int{

}
Copy after login

2. Error exception

try/catch

3. Using stack memory with zval

节约了内存分配
php5
zval*val;make_std_zval(val);

php7 zval val;
Copy after login

Recommended tutorial: PHP video tutorial

The above is the detailed content of Differences between php versions. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template