Работа с файлами / Текстовые файлы

<?php

$filePath  = getcwd() . "/tmp/file.txt";
$text = "Line 1\nLine 2";
file_put_contents($filePath, $text);