How can PHP be used to create or write files on a web server?

To create or write files on a web server using PHP, you can use the `file_put_contents()` function. This function takes two parameters: the file path and the content you want to write to the file. Make sure the directory where you want to create the file has the necessary write permissions.

<?php
$file = 'example.txt';
$content = 'Hello, World!';

file_put_contents($file, $content);
?>