You can write variables to a file with file_put_contents(). If the file pointed to does not exist it will be created. By adding FILE_APPEND this will append data to the created file, if not the file will be over written.
Смотрите видео PHP - Write to File - file_put_contents() онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Eli the Computer Guy 25 Декабрь 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 5,175 раз и оно понравилось 106 людям.