3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
17.57 ms | 402 KiB | 5 Q