Skip to content
Creating and Deleting a File:
- Use fopen() to create a new file.
- Use unlink() to delete a file from the server.
Reading and Writing Text Files:
- Use fread() to read data from a file.
- Use fwrite() to write data to a file.
Working with Directories in PHP:
- Use mkdir() to create a new directory.
- Use rmdir() to remove an empty directory.
Checking for Existence of File:
- Use file_exists() to check if a file exists.
Determining File Size:
- Use filesize() to get the size of a file in bytes.
Opening a File for Writing, Reading, or Appending:
- Use fopen() with different modes (w, r, a) for writing, reading, or appending.
Writing Data to the File:
- Use fwrite() to write content to an open file.
- Use fgetc() to read a character from a file.
- HTML forms collect user input on a web page.
- Users enter data in input fields, make selections, etc.
- Data submitted to a server for processing.
Super Global Variables:
- Predefined variables in PHP accessible globally.
- Examples: $_GET, $_POST, $_SESSION, $_COOKIE.
- Store and retrieve data across different parts of the script.
Super Global Array:
- Special array-like variables in PHP.
- Hold data from various sources, like form submissions.
Acquiring User Input:
- Collect user data using HTML forms.
- Forms use input fields, checkboxes, radio buttons, etc.
Importing User Input:
- PHP gets user input through form submissions.
- Access user input using $_POST or $_GET superglobals.
Accessing User Input:
- PHP processes user input by accessing superglobals.
- Example: $username = $_POST[‘username’];.
Combining HTML and PHP:
- Embed PHP code within HTML to make dynamic pages.
- Output PHP-generated data directly in HTML.
Using Hidden Fields:
- Hidden fields store data not shown to users.
- Useful for passing information between pages.
- PHP can redirect users to different pages.
- Uses header() function to send HTTP headers.
File Upload and Scripts:
- HTML forms can upload files from user devices.
- PHP scripts handle uploaded files, process, and store.
Deleting a File:
- PHP script can delete files on the server.
- Uses unlink() function to remove files.
- FTP transfers files, SMTP sends emails.
- FTP server handles file storage and transfer.
- SMTP server manages email sending and receiving.
- Math functions perform calculations (add, subtract, etc.).
- Used in programming to manipulate numbers.
- Allows users to send files from their device to a server.
- Common in web applications for sharing data.
- Enables users to get files from a server to their device.
- Used for accessing resources like documents or media.
E-Mail with PHP:
- PHP sends emails via SMTP protocol.
- Automates email creation and delivery.
PHP Configuration File:
- “php.ini” sets PHP runtime parameters.
- Controls behavior, memory usage, and more.
Error Tracking and Debugging:
- Process of finding and fixing code issues.
- Involves analyzing errors and testing code.
- Adds interactivity, dynamic behavior to websites.
- Runs on browsers, controls elements, and responds to user actions.
- Validates user inputs in web forms before submission.
- Provides real-time feedback to users.
- Prevents incorrect or incomplete data from being submitted.
- Ensures data integrity and better user experience.
- Validates email addresses entered in forms.
- Checks for proper format (username@domain).
- Ensures users provide valid email addresses.
- Helps reduce errors in email communication
- Simplifies DOM manipulation and event handling.
- Shortens code for common tasks.
- Improves development speed and cross-browser compatibility.