As soon as null casts to empty string in both cases there is no difference. The best for me  is 
    $isPrefixMatched = !$is_null($prefix) &&  strlen($prefix) ... (etc)

but it's too verbose and does exactly the same.