Reputation: 1
I'm trying to achieve something like $_SESSION[$key] without the need of foreach loop, how can I achieve this? Please let me know
Thanks
Upvotes: 0
Views: 108
Reputation: 1
the problem is sorted, I had to include single quotes in $_SESSION's index in order to make it treat like a non-numeric index.
Thanks for the help guys!
Upvotes: 0
Reputation: 28099
array_merge will do more or less what you want assuming id is never numeric and you want to put everything in $_POST
into $_SESSION
, which may not be a good idea
$_SESSION=array_merge($_SESSION,$_POST);
Upvotes: 1