tqla Posted October 22, 2009 Share Posted October 22, 2009 Hello, When I print the SESSION I see this: Array ( [program32] => Array ( [userId] => 2 ) ) The userid is indeed 2 and I need to use it. Can someone tell me how to isolate the userid and echo it? I've tried a few things but failed. Thanks. Link to comment https://forums.phpfreaks.com/topic/178551-solved-help-extracting-from-array/ Share on other sites More sharing options...
btherl Posted October 22, 2009 Share Posted October 22, 2009 Try this: echo $_SESSION['program32']['userId'] . " should have the value 2\n"; If you have multiple array elements then you can use foreach to go through each one in turn. Link to comment https://forums.phpfreaks.com/topic/178551-solved-help-extracting-from-array/#findComment-941637 Share on other sites More sharing options...
tqla Posted October 22, 2009 Author Share Posted October 22, 2009 Thanks btherl. that works great! Link to comment https://forums.phpfreaks.com/topic/178551-solved-help-extracting-from-array/#findComment-941645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.