Home > php教程 > php手册 > PHP 更高效的字符长度判断方法

PHP 更高效的字符长度判断方法

WBOY
Release: 2016-06-07 11:42:49
Original
948 people have browsed it

PHP 更高效的定长字符长度判断方法
今天看到有人说,在做字符串长度判断的时候,有个比strlen效率更高的方法。
即:
对于:$str = 'aaaaaa';if(strlen($str) > 6) VS if(!isset($str{6})后者比前者快3倍!
为什么呢?:
http://www.xuansky.cn/?p=35

AD:真正免费,域名+虚机+企业邮箱=0元

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