How to create a file and include in php code?

$file_var= fopen(“newfile.html”, ‘w’);
fwrite($file_var= , $html_elements);
fclose($file_var);

To use this file in html code:
include(“newfile.html”);