![]() |
$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?
|
$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:
|
I think I get you.
So how does this work inside templates? Like with PHP Code:
PHP Code:
|
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.
|
All times are GMT. The time now is 07:09 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|