DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • October 22, 2017, 03:43:32 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Asking a dumb question  (Read 2165 times)
0 Members and 1 Guest are viewing this topic.
Zanzaras
Captain of the Guard
***
Offline Offline

Posts: 219


*Snipe*


View Profile
« on: January 25, 2005, 03:15:02 PM »

I know this has been asked before, but I can't for the life of me find it or remember the answer to it, so I'll ask again.

There are two ways of referring to user variables (gold, hitpoints, etc):

1.) $session[user][gold]
2.) $session['user']['gold']

I was wondering what the difference between the two is (if there is any). I normally use the method without the tick marks since it's shorter.

(  See... told you it was a dumb question!     Tongue  )
Logged

"Intelligence is like a river, the deeper it is the less noise it makes."
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: January 25, 2005, 03:17:08 PM »

There are differences and were brought up in another thread, I believe it was the Poseidon Pool thread.

Basically, it makes it much easier for the DB to find things with the '' than without them.

Look for Arrays Do's and Don'ts in here:
http://www.php.net/manual/en/language.types.array.php
« Last Edit: January 25, 2005, 03:20:03 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5475



View Profile WWW
« Reply #2 on: January 25, 2005, 03:30:55 PM »

Although both work, $session['user']['hitpoints'] is the more correct method, and is now used consistently throughout the core code.  It is recommended that modders follow suit to avoid future parsing issues which may or may not arise.
Logged

Play the latest beta version here on DragonPrime
Zanzaras
Captain of the Guard
***
Offline Offline

Posts: 219


*Snipe*


View Profile
« Reply #3 on: January 25, 2005, 09:26:11 PM »

Thanks guys...  that was exactly what I was after.     Roll Eyes
Logged

"Intelligence is like a river, the deeper it is the less noise it makes."
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
21 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search