PHP File Handling: Read, Write and Delete Files
How PHP reads and writes files on the server โ file_put_contents, fopen, appending, reading line by line, and deleting โ each with a runnable example.
Browse all posts filed under Web Development.
๐ Web DevelopmentHow PHP reads and writes files on the server โ file_put_contents, fopen, appending, reading line by line, and deleting โ each with a runnable example.
๐ Web DevelopmentThe other way PHP talks to a database โ plain functions instead of objects. Connect, read, insert, update and delete, with no classes required.
๐ Web DevelopmentAll ten of them, the == versus === rule that catches everyone, and the PHP 8 change that most tutorials on the web still get wrong.
๐ Web DevelopmentPHP does not read your code left to right. It ranks every operator in the line and starts at the top. Here is the full table and the three rows that bite.
๐ Web DevelopmentPHP has two sets of logical operators โ the symbols and the words. They look interchangeable and they are not. Here is the difference, and when each one is right.
๐ Web DevelopmentMake your site remember who is visiting. PHP sessions explained: session_start, storing and reading $_SESSION, a small login gate, protecting a page, and logging out properly.
๐ Web DevelopmentMake your data survive the script. PHP MySQL explained: connecting with PDO, reading rows, prepared statements that stop SQL injection, and updating or deleting safely.
๐ Web DevelopmentRead what your visitors type. PHP forms explained: GET vs POST, reading $_POST safely, checking required fields, validating email, and escaping output with htmlspecialchars.
๐ Web DevelopmentMost of what a page shows is text. PHP strings explained: single vs double quotes, joining, length and case, search and replace, trimming, and explode with implode.