note 82771 added to control-structures.else
| From: | Theoden at osu1 dot php dot net | Date: | Fri, 25 Apr 2008 00:42:57 +0000 |
| Subject: | note 82771 added to control-structures.else | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138759@lists.php.net to get a copy of this message | ||
At Caliban Darklock
I don't know if it is just improvements in the parser, but there is a negligible difference in
the performance of "elseif" vs "else if" as of version 5. One thousandth of a
second in your example and 8 thousandths if the eval statement is repeated 5 times.
If the constructs are in regular code, then there appears to be no difference. This leads me to
believe that the difference in the eval code is from there being an extra parser token.
Also the main performance burden of recursive functions is the stack operations of changing the
context. In this case I believe that it would parse to very similar (if not identical) jmp controls.
In summary, use your preference. Readability and maintainability rank far higher on the priority
scale.
One Additional note, there appears to be a limit of the number of "else if" statements
(perhaps nested statements in general) that php will handle before starting to get screwy. This
limit is about 1100. "elseif" is not affected by this.
----
Server IP: 64.71.164.2
Probable Submitter: 71.103.101.15
----
Manual Page -- http://www.php.net/manual/en/control-structures.else.php
Edit -- https://master.php.net/note/edit/82771
Del: integrated -- https://master.php.net/note/delete/82771/integrated
Del: useless -- https://master.php.net/note/delete/82771/useless
Del: bad code -- https://master.php.net/note/delete/82771/bad+code
Del: spam -- https://master.php.net/note/delete/82771/spam
Del: non-english -- https://master.php.net/note/delete/82771/non-english
Del: in docs -- https://master.php.net/note/delete/82771/in+docs
Del: other reasons-- https://master.php.net/note/delete/82771
Reject -- https://master.php.net/note/reject/82771
Search -- https://master.php.net/manage/user-notes.php