note 114710 added to control-structures.elseif
| From: | peter dot mlich at volny dot cz | Date: | Thu, 27 Mar 2014 10:11:01 +0000 |
| Subject: | note 114710 added to control-structures.elseif | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199053@lists.php.net to get a copy of this message | ||
To Rudi / 3 years ago
Try switch in switch($name) case 'word': break; . --- slow
Try if/else and if/elseif in $name='word'. --- in my fast test, place 3
Try isset in isset($array[$name]). --- place 1
Try in_array in in_array($name,$array). --- slow
Try array_key_exists in array_key_exists($name,$array).
Try return (end function) in if/elseif with -- place 2
if('word'==$name) {
$parsed[$name]=$text;
return;
}
elseif('word'==$name) {
$parsed[$name]=$text;
return;
}
PHP 5.35, xml_parse function, i parsed 9.2MB xml file to sql, script in place 1 do it at 11.54s (do
more than only condition)
----
Server IP: 147.32.160.17
Probable Submitter: 193.84.207.136
----
Manual Page -- http://php.net/manual/en/control-structures.elseif.php
Edit -- https://master.php.net/note/edit/114710
Del: integrated -- https://master.php.net/note/delete/114710/integrated
Del: useless -- https://master.php.net/note/delete/114710/useless
Del: bad code -- https://master.php.net/note/delete/114710/bad+code
Del: spam -- https://master.php.net/note/delete/114710/spam
Del: non-english -- https://master.php.net/note/delete/114710/non-english
Del: in docs -- https://master.php.net/note/delete/114710/in+docs
Del: other reasons-- https://master.php.net/note/delete/114710
Reject -- https://master.php.net/note/reject/114710
Search -- https://master.php.net/manage/user-notes.php