Hello,
I have assigned an array to a session variable.
Now I want to unset the array key. How can I perform this.
What I was trying was:
unset(Yii::app()->session[$variable][$key]);
it gives error.
Can you please suggest me the way to perform this action.
Any help will be highly appreciated.
This website uses cookies to provide necessary website functionality, improve your experience and analyze our traffic. By using our website, you agree to our Privacy Policy and our cookies usage.
2 Comments
Hello,
I have assigned an array to a session variable.
Now I want to unset the array key. How can I perform this.
What I was trying was:
unset(Yii::app()->session[$variable][$key]);
it gives error.
Can you please suggest me the way to perform this action.
Any help will be highly appreciated.
Regards
You can try the following
Yii::app()->session[$variable][$key] = null;