Q:

How to retrieve those entries from an array that contain the prefix `TEST`?

$data[0] = "TESTaabsc";
$data[1] = "ffgaabsc";
$data[2] = "TESTffga";

for($i=0; $i<sizeof($data); $i++)
{
if (!is_null($data[$i][0]) && (???)) 
{
//...
}
}

How to retrieve those entries from $data that contain the prefix TEST?

A:

Using strpos():
for($i=0; $i<sizeof($data); $i++)
{
    if(strpos($data[$i], 'TEST') === 0)
    {
        // $data[$i] has the prefix
    }
}

Or to get the matches in a new array you can use array_filter():
$result = array_filter($data, function($var){
    return strpos($var, 'TEST') === 0;
});

print_r($result); // $result is an array containing the matches only

