I have An array which looks like following after using print_r
print_r
Array ( [0] => Array ( [0] => piklu [name] => piklu ) [1] => Array ( [0]
i m not sure but maybe its something like this. You want to serialize() the array on writting. it will put your array into test.txt
file_put_contents('test.txt', serialize($array));