For correct benchmarking you should run the test also when $foo == 'string'

Gerard Samuel wrote:

Looking to squeeze as much out of my core scripts (not that they are slow ;) ).
The thought arose that I can replace simple functions like
is_string(), is_array() with simpler php code.
For example ->
<?php


$foo = array('foo','foo','foo','foo','foo','foo','foo','foo','foo','foo',
                  'foo','foo','foo','foo','foo','foo','foo','foo','foo','foo',
                  'foo','foo','foo','foo','foo','foo','foo','foo','foo','foo');

for($x=0; $x < 50; $x++)
{
    if ($foo === @(array)$foo)
//    if (is_array( $foo ))
    {
        echo 'true<br />';
    }
    else
    {
        echo 'false<br />';
    }
}

?>

It seems to work, and debugging it via APD shows that it uses less resources.
Just an idea, nothing serious.
Thanks



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to