全体が適切にエスケープされた文字列であると仮定すると、この関数を使用してすべての部分の配列を取得できます
<?php
function cutMultiple($start, $end, $from)
{
$results = array(); // init the output
$step1 = explode($start, $from); // get the results
for( $i = 1; $i<count($step1); $i++)
{
$outputs = explode($end, $step1[$i]); // get final cut
$results[] = $outputs[0]; // append the cut
}
return $results;
}
$text = 'Love is an emotion of a strong <"/affection and personal/"> attachment. Love is also a virtue representing <"/all of human kindness/">, compassion, and affection';
echo cutMultiple('<"/', '/">', $text);
?>
または、正規表現のアプローチを使用してください。
これは問題の最善の解決策ではないと言わざるを得ませんが、間違いなく迅速な解決策です