- preg_match: documentation ( source)
- strtolower: documentation ( source)
<?php
$qqlQueryOrMetric = " * from somethings";
$match = preg_match('/select.*from/', strtolower($qqlQueryOrMetric), $matches);
if ($matches) { echo "yes"; } else { echo "no";}