<?php $foo = '112312312312323'; $start_time = microtime(true); for ($i = 0; $i < 10000; $i++) { $foo = $foo.'1'; preg_match('/^[a-zA-Z0-9]+$/', $foo); // Result: 0.094325065612793 } $end_time = microtime(true); echo 'preg_match Result: ' . ($end_time - $start_time).PHP_EOL; $foo = '112312312312323'; $start_time = microtime(true); for ($i = 0; $i < 10000; $i++) { $foo = $foo.'1'; ctype_alnum($foo); // Result: 1.8465659618378 } $end_time = microtime(true); echo 'ctype Result: ' . ($end_time - $start_time).PHP_EOL;
You have javascript disabled. You will not be able to edit any code.