The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
Quote:
PHP Code:
...you would have "10" displayed on screen. Was I mistaken? |
#12
|
||||
|
||||
Quote:
I just wrote the echo line to show that the variable can be used normally. You don't have to echo it, you can use it like any other variable. |
#13
|
||||
|
||||
Quote:
Well, that being the case - I'm still curious - is there any difference in function or performance between returning the values or globalising the variables? Or are there no significant differences or merits to using one as opposed to the other? |
#14
|
||||
|
||||
Globalising a variable is useful IMO when you have a lot of data you wanna pass back in many different variables, whereas a small function for a sepcific purpose might just return one value or array, in which case returning the variable and keeping it out of the $GLOBALS array may be more suitable.
Two examples: - passing a number to a function to return a ordinalised string (1, 2, 3 => 1st, 2nd, 3rd) would be better simply to have PHP Code:
PHP Code:
- If you are trying to test for or generate a data caches, you might be better off globalising them at the start of the function, then you wont have to create a multi-dimensional array of the values you want to return, then PHP Code:
I hope that makes sense? |
#15
|
||||
|
||||
Quote:
|
#16
|
||||
|
||||
Quote:
|
#17
|
||||
|
||||
Quote:
Thanks, all! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|