<?php

$str = "23456789ABCDEGHJKMNPQRSTUVXYZabcdeghjkmnpqrstuvxyz";
$excludes = ['cp','cb','ck','c6','c9','rn','rm','mm','co','do','cl','db','qp','qb','dp','ww'];

$t0 = microtime(true);

for ($i = 0; $i < 1000000; $i++)
    if (preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $str))
        break;

$t1 = microtime(true);

for ($i = 0; $i < 1000000; $i++)
    foreach($excludes as $ex)
        if (false !== strpos($str, $ex))
            break 2;

$t2 = microtime(true);

echo "regexp: " . ($t1 - $t0) . "\n";
echo "strpos: " . ($t2 - $t1) . "\n";
