note 98041 deleted from function.fwrite by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: nuit 

----

i have been the reading the notice from chaly: it's far simpler to use the serialize function...i think there's a json function aswell: (simple example)
<?php
function save_array_to_file($filename,$b) {
    $file = fopen($filename,'w+');
    fwrite($file,serialize($b));
    fclose($file);
}

function read_array_from_file($filename) {
    return unserialize(file_get_contents($filename));
}

$array = array('hallo', 'test' => 'noch ein test');
print_r($array);
save_array_to_file('array.txt',$array);
$arr2 = read_array_from_file('array.txt');
print_r($arr2);
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.