Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php save array to file

$arr1 = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
file_put_contents("array.json",json_encode($arr1));
# array.json => {"a":1,"b":2,"c":3,"d":4,"e":5}
$arr2 = json_decode(file_get_contents('array.json'), true);
$arr1 === $arr2 # => true
 
PREVIOUS NEXT
Tagged: #php #save #array #file
ADD COMMENT
Topic
Name
6+2 =