如何检查在 N 个文本之后包含文本的值变量。
例:
$a = "I need you";
然后 PHP 做点什么:
<?php
check if in $a after text "you" there is a text, then echo found text after "You"
?>
我该怎么做?
你可以
这样做:
$a = "I need you";
$search = "need";
$substring = substr($a, strpos($a,$search)+strlen($search));
echo $substring;
呼应"你"
您可以使用
explode()
$exploded = explode('you', $a);
if(!empty(end($exploded))){
echo "Found text after you";
}