- preg_replace: documentation ( source)
<?php
$str = 'SIM UMTS ITALIA 15.5" BLACK';
echo preg_replace('/^.*?(\d[\d.]*)".*$/', '$1', $str) . "\n";
$from = " ";
$to = '"';
function getStringBetween($str,$from,$to){
return preg_replace("/^.*$from([^$from]+)$to.*$/", '$1', $str);
}
echo getStringBetween($str, $from, $to);