<?php$flip = array('even' => 'odd', 'odd' => 'even');$class = 'even';$time_start = microtime(true);for ($number = 0; $number < 200000; $number++) { $class = ($number % 2 == 1) ? 'even': 'odd';}$time_end = microtime(true);$old_time = $time_end - $time_start;$time_start = microtime(true);for ($number = 0; $number < 200000; $number++) { $class = $flip[$class];}$time_end = microtime(true);$array_flip_time = $time_end - $time_start;$time_start = microtime(true);for ($number = 0; $number < 200000; $number++) { $class = $class == 'even' ? 'odd' : 'even';}$time_end = microtime(true);$tri_flip_time = $time_end - $time_start;echo "Old time is $old_time seconds\n";echo "Array flip time is $array_flip_time seconds\n";echo "Trinary flip time is $tri_flip_time seconds\n";?>/**Results:Old time is 2.94821381569 secondsArray flip time is 2.82611393929 secondsTrinary flip time is 3.10265183449 secondsOld time is 2.9622759819 secondsArray flip time is 2.9366338253 secondsTrinary flip time is 3.28688883781 secondsOld time is 3.1440680027 secondsArray flip time is 2.91075491905 secondsTrinary flip time is 3.05684518814 secondsOld time is 3.09293603897 secondsArray flip time is 2.87835907936 secondsTrinary flip time is 3.03077507019 secondsOld time is 3.16652011871 secondsArray flip time is 2.86847901344 secondsTrinary flip time is 3.02843999863 seconds*/