I tested the rapidity of isset vs array_key_exists. I always thougt that array_key_exists would be the winner ... Here is my script : ┌─(yoda@ev5)(14:25:29) └─(~/var/www/test)-> cat isset_array-key-exists.php #!/usr/bin/php <?php define('N', "\n"); error_reporting(E_ALL | […]
(3)
PHP bench: count + for vs foreach vs while
I tested different loops. Here is my test script : ┌─(yoda@ev5)(14:32:05) └─(~/var/www/test)-> cat for_foreach_while.php #!/usr/bin/php <?php define('N', "\n"); error_reporting(E_ALL | E_NOTICE); $nbLoop = 10000; $testArray = array_fill(0, 500, 'toto'); $time = array(); […]
Symfony: Validate fields depending of another field (update 2010-02-23)
It's possible, when validating a form, to check if a field is correct dependently of an other field's value. First, in your configure method, after the declaration of your validators, add : $this->validatorSchema->setPostValidator( new sfValidatorCallback( array('callback' => array($this, […]