file_put_contents($filename, $src) is useful function if you want to save a text file in PHP
<?php $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}'; file_put_contents( "foo.json", $json); ?>
If you want to read the file, you can also use file_get_contents( $filename).