$data = "
usera: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy.
userb: eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam.
userc:voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet.";
preg_match_all("/(.*:)/", $data, $why1);
array_walk_recursive($why1, function($value) use (&$why2) {
$why2[] = $value;
});
$why3 = array_unique($why2);
$why4 = array_values($why3);
preg_match_all("/(.*.)/", $data, $info);
array_walk_recursive($info, function($value) use (&$shrink) {
$shrink[] = $value;
});
$brss = array_unique($array_flat);
$arss = array_values($brss);
for($i=0;$i < count($brss); $i++){
$usera = "$why4[0]";
$userb = "$why4[1]";
$userc = "$why4[2]";
$userd = "$why4[3]";
if (strpos($brss[i], $usera) !== false)
// How can I
{echo "true";}
// ?
// I only get false
else {echo "false";}
}
How to get a true in searching my array by asking a specific word with strpos?
如何通过向strpos询问一个特定的单词来实现对数组的搜索?
How can I echo "true";
?
我如何回应“真实”?
1 个解决方案
#1
0
if (strpos($brss[**$i**],$usera)!==false) {
echo "true";
} else {
echo "false";
}
Does it.
它。
#1
0
if (strpos($brss[**$i**],$usera)!==false) {
echo "true";
} else {
echo "false";
}
Does it.
它。