The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#21
|
||||
|
||||
![]()
The function is kind of redundant, the only time it helps is with clarity for new coders. I just tend to use in my scripts
![]() PHP Code:
|
#22
|
|||
|
|||
![]() Quote:
From functions.php PHP Code:
|
#23
|
||||
|
||||
![]()
actually my editor highlights it as well, as i'm highlighting some vb functions ^^
|
#24
|
|||
|
|||
![]()
iif() is handy for true and false returns. However if you use it to test and then pass data, if the data chunk is large, it may be much more inefficent then a plain old if/else.
|
#25
|
|||
|
|||
![]()
I did just notice one major problem with it, but it's the design of PHP (and most other languages) that causes it: the ternary operator supports lazy evaluation (only evaluates what is needed based on the condition), whereas the iif() function evaluates all of its arguments regardless of the condition's value.
An excerpt of my code that demonstrates the problem: PHP Code:
|
#26
|
|||
|
|||
![]()
Ah yes and here's the example I had written and realized the overhead it created just moving a copy of the data, I overlooked that it executed the addslashes() function as well even if it was not needed.
This is very inefficient, in some cases $data could have been 1MB... PHP Code:
|
#27
|
||||
|
||||
![]()
as the name of the varibles vb defined, this is absolutely useful for boolean vale the best.
|
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|