search
HomeBackend DevelopmentPHP7Compare the running efficiency of php7 and php 5.5

Compare the running efficiency of php7 and php 5.5

Recommended (free): PHP7

Read the website’s php7 installation article step by step After a lot of hard work, I finally installed php7.

php7 installation tutorial address:

http://www.hcoder.net/books/read_10101.html

It is said that php7 runs extremely efficiently, is it true? Let me try it myself. The code is as follows:

<?php
$stratTime   = microtime(true);
$startMemory = memory_get_usage();
$a = 1;for($i = 1; $i <= 100000; $i++){
	$a++;}echo $a;$endTime    = microtime(true);$runtime    
	= ($endTime - $stratTime) * 1000; 
	//将时间转换为毫秒$endMemory  = memory_get_usage();
	$usedMemory = ($endMemory - $startMemory) / 1024;echo "运行时间: {$runtime} 毫秒<br />";echo "耗费内存: {$usedMemory} K";

The above code records the time and memory consumed by php running 100,000 cycles.

php7 operation situation

100001运行时间: 3 - 7 毫秒耗费内存: 0.109375 K

php5.5 operation situation

100001运行时间: 18 - 30 毫秒耗费内存: 0.671875 K

It seems that it is really much faster! ! ! Time saved 6 times, memory saved 6 times. Very good data!

However, webmasters still need to be cautious when upgrading php7, because many plug-ins have not been updated yet! For example, the latest memcache extension has not been released yet...

We can learn the changes of php7 in advance and use them decisively when it matures! !

The above is the detailed content of Compare the running efficiency of php7 and php 5.5. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment