我有我的变量$mustcontain
,我有以下内容:
if ($getvideoviews >= $minimumvideoviews
AND $getvideolikes >= $minimumvideolikes
AND $VidDuration >= $minvidlenght
AND $getchannelsubscribers >= $minsubs)
我需要检查$videotitle
是否包含$mustcontain
中的内容,如果为真,则继续显示更多信息
答案 0 :(得分:0)
您可以使用strpos()
或in_array()
:
如果$mustcontain
是字符串:
if ($getvideoviews >= $minimumvideoviews
&& $getvideolikes >= $minimumvideolikes
&& $VidDuration >= $minvidlenght
&& $getchannelsubscribers >= $minsubs
&& strpos($videotitle, $mustcontain) !== false) {
// do sth. with it
}
如果$mustcontain
是数组:
if ($getvideoviews >= $minimumvideoviews
&& $getvideolikes >= $minimumvideolikes
&& $VidDuration >= $minvidlenght
&& $getchannelsubscribers >= $minsubs
&& in_array($videotitle, $mustcontain) !== false) {
// do sth. with it
}