cbassett03 Posted August 23, 2012 Share Posted August 23, 2012 When storing and retrieving data using sessions in PHP, is it OK to do something like this: $_SESSION['person']['lastname'] Or should I just stick to something like: $_SESSION['person_lastName'] I personally like the first example better for ease of reading and interpreting, but want to make sure that it can be traversed (using an array) and is "safe" to use (and that won't crash a PHP script). Quote Link to comment https://forums.phpfreaks.com/topic/267461-is-this-safe-to-do-with-a-_session-variable/ Share on other sites More sharing options...
scootstah Posted August 23, 2012 Share Posted August 23, 2012 Using a multi-dimensional array is no more or less safe than using a one-dimensional array. Quote Link to comment https://forums.phpfreaks.com/topic/267461-is-this-safe-to-do-with-a-_session-variable/#findComment-1371701 Share on other sites More sharing options...
Christian F. Posted August 23, 2012 Share Posted August 23, 2012 Just try, and you'll soon find out if it works or not. Quote Link to comment https://forums.phpfreaks.com/topic/267461-is-this-safe-to-do-with-a-_session-variable/#findComment-1371703 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.