- strpos: documentation ( source)
- microtime: documentation ( source)
- preg_match: documentation ( source)
- explode: documentation ( source)
- number_format: documentation ( source)
<?php
$time = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
preg_match('/^label-(.+)/', 'label-en_US', $matches);
}
$time = microtime(true) - $time;
echo 'preg_match() took ' . number_format($time, 3) . ' seconds' . "\n";
$time = microtime(true);
for ($i = 0; $i < 10000; $i++) {
strpos('label', 'label-en_US');
explode('-', 'label-en_US');
}
$time = microtime(true) - $time;
echo 'explode() took ' . number_format($time, 3) . ' seconds' . "\n";