[英]PHP : search for a string within a string
I want to check whether a string is present in another string, and then take the appropriate action. 我想检查另一个字符串中是否存在一个字符串,然后采取适当的措施。 What is the best way to do this? 做这个的最好方式是什么?
For instance; 例如; if the string 'europe' is present in 'europeisthebest', then do something. 如果字符串“ europe”出现在“ europeisthebest”中,请执行某些操作。
if ( isIn('europe', 'europeisthebest') == true){
//do something
}
Thank you a lot! 非常感谢! I appreciate all of your answers and time spent helping. 感谢您提供的所有答案和所花费的时间。
如果您想知道子字符串在字符串中的位置,也可以使用函数strpos()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.