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