"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Thanks, I am going to implement this one "$_SESSION['username'][$Site_ID] = $username;" and see how it goes, the reason why i am using is to be able to open more than one website in a browser by keeping there session separate from each other so if i log out from website it will not affect the other site, my present code "$_SESSION['username_'.$Site_ID] = $username; " is working fine but i think it is not professional way to do,
One thing i need to clarify is "$_SESSION['username']["{$Site_ID}"] = $username; note the " { } " inside the array rather than just the variable is good idea than "$_SESSION['username'][$Site_ID] = $username;" because site_id will be different for every site opened in the browser.
There is no reason in this case to put quotes or curly braces around the $Site_ID variable when being used as an array key. While it will work, all it accomplishes is a tiny bit of extra processing by the PHP parser. In the end, it's still just the variable itself that needs to be parsed.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks