Home > php教程 > php手册 > body text

深入理解PHP中的数组-Array

WBOY
Release: 2016-06-06 19:47:12
Original
1055 people have browsed it

很好的一篇讲解PHP数组的博文,详细讲解了php中数组与其他语言的差别,内核如何实现数组,数组的遍历,另外还分析了网上广为谬传的foreach比for性能好的说法。 我自己也测试了下foreach和for的性能,在php 5.3 和5.4版本下,不管遍历时是否改写数组,还是for

很好的一篇讲解PHP数组的博文,详细讲解了php中数组与其他语言的差别,内核如何实现数组,数组的遍历,另外还分析了网上广为谬传的foreach比for性能好的说法。


我自己也测试了下foreach和for的性能,在php 5.3 和5.4版本下,不管遍历时是否改写数组,还是foreach时用引用方式,结果都未显示foreach优于for,我自己测试的结果是for比foreach还稍微快那么点儿:)如果foreach不采用引用方式,那for比foreach就快许多~


分享在此:


英文原文:A Closer Look Into PHP Arrays: What You Don’t See

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!