Write a string to a file in PHP

Description

The following code shows how to write a string to a file.

Example



<?php
    echo file_put_contents("test.txt","Hello World. Testing!");
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip