The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
$variable[option] / $variable['option']
I don't know if I've used the terms correctly and this is probably a basic php question but what's the difference between something like say $userinfo[username] and $userinfo['username']. Are there specific situations in which you use the apostrophes for this in templates or php files?
|
#2
|
||||
|
||||
$userinfo['username'] is proper, because 'username' (string) is key in the $userinfo array. The first one would be correct if username was a constant, or if its being parsed within double quotes (which templates are).
PHP Code:
|
#3
|
|||
|
|||
I think I get you.
So how does this work inside templates? Like with PHP Code:
PHP Code:
|
#4
|
||||
|
||||
Template conditions are parsed as raw PHP (using ternary opreator) so you will need to quote the array keys. Not doing so can result in some nasty PHP-5 related bugs (like if the key is 'private', since its a new keyword). But, in the rest of the template, you don't need it.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|