3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; $str = 'NGM YOU COLOR P550 DUAL SIM 5.5" IPS HD CURVO QUAD CORE 8GB RAM 1GB 4G LTE'; echo getStringBetween($str, ' ', 'GB') . "\n";

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
161.48 ms | 1997 KiB | 15 Q