how could i save a php code into a php file with fopen()

for examble i want to save this code into php file

PHP Code:
<?php
$a
=fopen("one.php","w");
fwrite($a,"any thing");
fclose($a);
?>