mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #3927 from chinpei215/master-h-opt
A micro optimization of h()
This commit is contained in:
commit
5af65f3a28
1 changed files with 3 additions and 1 deletions
|
@ -169,7 +169,9 @@ if (!function_exists('h')) {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#h
|
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#h
|
||||||
*/
|
*/
|
||||||
function h($text, $double = true, $charset = null) {
|
function h($text, $double = true, $charset = null) {
|
||||||
if (is_array($text)) {
|
if (is_string($text)) {
|
||||||
|
//optimize for strings
|
||||||
|
} elseif (is_array($text)) {
|
||||||
$texts = array();
|
$texts = array();
|
||||||
foreach ($text as $k => $t) {
|
foreach ($text as $k => $t) {
|
||||||
$texts[$k] = h($t, $double, $charset);
|
$texts[$k] = h($t, $double, $charset);
|
||||||
|
|
Loading…
Reference in a new issue