How does the file handling process differ between PHP4 and PHP5 when reading and writing to a file?

In PHP4, the file handling functions used the resource type to represent file handles, while in PHP5, the file handling functions use the resource type to represent file handles. Therefore, the file handling process remains similar between PHP4 and PHP5 when reading and writing to a file.

// PHP code snippet for reading and writing to a file in PHP5
$file = fopen("example.txt", "r+");
if ($file) {
    // Read from the file
    $content = fread($file, filesize("example.txt"));

    // Write to the file
    fwrite($file, "New content");

    fclose($file);
}