Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

PHP File I/O

Reading Files

// Read entire file
$content = file_get_contents("data.txt");

// Read line by line
$handle = fopen("data.txt", "r");
while (($line = fgets($handle)) !== false) {
echo $line;
}
fclose($handle);

Writing Files

file_put_contents("output.txt", "Hello, World!");

// Append mode
$handle = fopen("log.txt", "a");
fwrite($handle, "New entry
");
fclose($handle);

File Functions

file_exists($path); // Check if file exists
filesize($path); // Get file size
unlink($path); // Delete file
rename($old, $new); // Rename/move

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir