<?php
function getStringBetween($str,$from,$to){
if (preg_match("/$from([^$from]+)$to/", $str, $matches))
return $matches[1];
else
return '';
}
$str = 'SIM UMTS ITALIA 35GB BLACK';
echo getStringBetween($str, ' ', 'GB') . "\n";
$str2 = 'SIM UMTS ITALIA IPHONE 2 MEGAPIXEL';
echo getStringBetween($str2, ' ', 'GB') . "\n";
$str3 = 'SIM UMTS ITALIA 15.5" BLACK';
echo getStringBetween($str3, ' ', '"') . "\n";
preferences:
27.92 ms | 402 KiB | 5 Q