- 数组 Array处理(用于打印或其它处理):
foreach ($array as $key => $value)
{
if ($value == $match)
{
$count++;
}
}
- 字串截取(截出delimeter之后的字串)
$arr = explode('delimeter', $initialString);
$important = $arr[1];
或
$important = explode("delimeter",$initialString)[1];
- 字串截取(截出dd/和/之间的字串)
- 可多次截取
$re = "~(?<=dd/).*?(?=/)~";
$str = "aa/bb/cc/dd/55/44/dd/66/";
preg_match_all($re, $str, $matches);
print_r($matches[0]);