
Must-Know PHP Concepts
What is PHP? Introduction To PHP | What Is PHP Programming | PHP Tutorial For Beginners | Simplilearn
Some of my highly recommended resources:
- PHP For Beginners | 3+ Hour Crash Course (Traversy Media): https://www.youtube.com/watch?v=BUCiSSyIGGU
- Query A Database Using PDO In OOP PHP | Object Oriented PHP Tutorial | PHP Tutorial | mmtuts: https://www.youtube.com/watch?v=m_-vmSv2PFo
1. Syntax and Basics
- Data Types (Denoted by a $)
- integers
- floats
- string
- arrays
- objects and resources
- NULL
- Operators
- arithmethic
- assignment
- comparison
- logical operators
- Conditions/Loops
- if else statements
- switch
- while
- do-while
- for loop
- forEach loop
2. Functions
- Function definition: SYNTAX: function() { echo "Hello World" }
- Built-in functions for:
- string manipulation
- array manipulation
- file operations
- etc...
3. Tables
- Indexed tables: tables with numerical indexes.
- Associative tables: tables with named keys.
- Multidimensional arrays: Arrays that contain one or more arrays.
4. Object-Oriented Programming (OOP)
- PHP is an object-oriented language that supports classes and objects.
- Inheritance: PHP allows classes to inherit properties and methods from other classes.
- Access modifiers: public, protected and private are used to control access to members of a class.
- Special methods
- __construct()
- __destruct()
- __get()
- __set()
- __call()
- etc...
5. Global
- Arrays of variables are passed to the current script via URL parameters and HTTP POST.
- $_GET
- $_POST:
- Used to store sessions and cookies.
- $_SESSION
- $_COOKIE:
- $_SERVER - An array containing information about headers, paths and script locations.
6. Error Handling
- error_reporting() - Configure and handle errors using the
- handle exceptions by using sample blocks
- custom error and exception handlers.
7. File manipulation
- Functions:
- fopen()
- fread()
- fwrite()
- file_get_contents()
- etc.
- Manage file uploads using forms.
8. Database Interaction
- Database Interaction Extensions.
- MySQL
- PDO
- Prepared expressions - Using prepared expressions to perform queries safely.
9. Sessions and Cookies
- Sessions: A mechanism for storing user data across multiple pages.
- Cookies: storage of data on the client to track user sessions.
10. Processing of forms
- Verification: Verification of user inputs from forms.
- Sanitize: Sanitize streams to prevent vulnerabilities such as SQL injection and XSS.
11. Security
- SQL injection: Prevent SQL injection with predicates and proper input sanitization.
- XSS (Cross-Site Scripting): Avoiding XSS by sanitizing user input.
- CSRF (Kross-Site Request Forgery): Implementation of CSRF tokens against CSRF attacks.
12. Regular expressions
- Pattern matching: Using regular expressions to match patterns and manipulate text.
13. PHP settings
- php.ini: Configure PHP settings with the php.ini file.
- htaccess: Using .htaccess for URL configuration and rewriting.
14. Frameworks and Content Systems
- Popular frameworks:
- Laravel
- Symfony
- CodeIgniter
- etc.
- Content Management System (CMS)
- WordPress
- Joomla
- Drupal
- etc.
15. Composer
- Dependency Management: Using Composer to manage project dependencies.
- Understanding these concepts provides a solid foundation for working with PHP in various web development projects.