0

How to split session values?
I am getting error like "Notice: Array to string conversion in PHP" in session;
How to solve that?

4
Contributors
3
Replies
18
Views
2 Years
Discussion Span
Last Post by diafol
0

Depends on the structure of the array and the data type, you could use implode() to flat the array to a string:

$a = ['a' => 123, 'b', TRUE, 'c', NULL, 'd', 'e' => [1,2,3]];
print_r(implode(', ', $a));

# returns 123, b, 1, c, , d, Array

But as you see: you loose the index key a, with booleans and null you get a conversion and the nested array is converted to Array, not showing the data.

0

Split on what condition? Give an example of a session variable you have and how would you like to have it split.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.