php - 检查字符串是否与 php 中的另一个字符串相似?

标签 php string if-statement

我需要检查 $string1 == $string2 但我不希望一个大写另一个小写有关系,例如我想要 if (harrisburg == HARRISBURG) 返回真值!执行此操作的最佳方法是什么?

最佳答案

strtolower($string1) == strtolower($string2)

关于php - 检查字符串是否与 php 中的另一个字符串相似?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14889745/

相关文章:

ios - didSelectRowAtIndexPath 或 prepareForSegue 使用?

php - 使用错误的输入初始化类会使其无法使用,但对象仍然存在

php - 将包含数字范围的 GET 变量转换为 PHP 中的字符串

php - preg_replace 如何在 PHP 中用 "包围字符串的 html 属性

python - 'str.contains' 不返回数据框中的值

c# - if else if in while 循环 were else if test 在第一个循环中定义

phpinfo() 没有更新到终端版本?

php - 减少数组信息

php - 访问YouTube API时出错: 'Warning: file_get_contents() [function.file-get-contents]: URL > file-access is disabled…'

python - Python中模块的条件导入