gpt4 book ai didi

php - 哪种方法是首选 strstr 或 strpos?

转载 作者:IT老高 更新时间:2023-10-28 11:55:17 29 4
gpt4 key购买 nike

我注意到很多开发人员同时使用 strstr 和 strpos 来检查子字符串是否存在。是首选其中之一吗?为什么?

最佳答案

来自 PHP online manual :

If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead.

关于php - 哪种方法是首选 strstr 或 strpos?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5820586/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com