0) { $prefix = drupal_substr($str, 0, 1); // echo $prefix; $str = drupal_substr($str, 1); } } $time = microtime_float()-$start; echo "$time\n"; $start = microtime_float(); for ($i = 0; $i < TRIALS; ++$i) { $str = test_str(); $len = drupal_strlen($str); for ($i = 0; $i < $len; ++$i) { $char = drupal_substr($str, $i, 1); // echo $char; } } $time = microtime_float()-$start; echo "$time\n"; $start = microtime_float(); for ($i = 0; $i < TRIALS; ++$i) { $str = test_str(); $len = drupal_strlen($str); for ($i = 0; $i < $len; ++$i) { $char = iconv('UTF32', 'UTF8', substr(iconv('UTF8', 'UTF32', $str), $i<<2, 4)); // echo $char; } } $time = microtime_float()-$start; echo "$time\n";