A micro optimization of h()

In most cases, the first argument of h() will be a string.
This commit is contained in:
chinpei215 2014-07-10 20:53:10 +09:00
parent 106d4ef12e
commit 1a58b76e42

View file

@ -169,7 +169,9 @@ if (!function_exists('h')) {
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#h
*/
function h($text, $double = true, $charset = null) {
if (is_array($text)) {
if (is_string($text)) {
//optimize for strings
} elseif (is_array($text)) {
$texts = array();
foreach ($text as $k => $t) {
$texts[$k] = h($t, $double, $charset);