note 99871 added to language.oop5.constants

From: Date: Sat, 11 Sep 2010 17:54:17 +0000
Subject: note 99871 added to language.oop5.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-172486@lists.php.net to get a copy of this message
To John Galt: remember that eval is a costly operation ( eval is evil ) some alternatives: <?php $score = array(); $start = microtime( true ); explode( ';', 'A;B;C;D' ); $score['explode'] = microtime(true) - $start; $start = microtime(true); unserialize('a:4:{i:0;s:1:"A";i:1;s:1:"B";i:2;s:1:"C";i:3;s:1:"D";}'); $score['unserialize'] = microtime(true) - $start; $start = microtime(true); eval('return array("A", "B", "C", "D");'); $score['eval'] = microtime(true) - $start; print sprintf( "method %s is slowest\n", array_search( max( $score ), $score )); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 212.182.187.28 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.constants.php Edit -- https://master.php.net/note/edit/99871 Del: integrated -- https://master.php.net/note/delete/99871/integrated Del: useless -- https://master.php.net/note/delete/99871/useless Del: bad code -- https://master.php.net/note/delete/99871/bad+code Del: spam -- https://master.php.net/note/delete/99871/spam Del: non-english -- https://master.php.net/note/delete/99871/non-english Del: in docs -- https://master.php.net/note/delete/99871/in+docs Del: other reasons-- https://master.php.net/note/delete/99871 Reject -- https://master.php.net/note/reject/99871 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172486) next »