I am using file_put_contents($file, $data); function for putting contents in file, because these files are created on fly with name of sessions, $data is an multi-dimensional array, when i am echoing array it prints out fine but in file no contents get recorded except the word Array
What should i do or is there any other function which automatically creates the file and records the data (array)?
Thank You.
You want to
serialize()the array on writting, andunserialize()after reading the file.Oh, and I really don’t now how you echo’d your array, but
echo array('foo' => 'bar');will always printArray.