Welcome to the PHP tutorial! This PHP tutorial helps you learn how to develop dynamic websites and web applications using PHP from scratch.
PHP is one of the most popular programming languages for web development.
PHP allows you to develop various web applications, including blogs, content management systems (CMS), and online stores.
Section 2. PHP Fundamentals
- Syntax – introduce you to the basic PHP syntax, including sensitivity, statements, whitespace, and linebreak.
- Variables – show you how to use variables to store data in PHP.
- Constants – define constants that hold a value that doesn’t change throughout the script.
- Comments – learn how to document your code effectively using comments.
- var_dump – learn how to dump the information about a variable.
Section 3. PHP Types
- Data types – give you a quick overview of PHP types, including scalar types, compound types, and special types.
- Boolean – learn how to represent a truthy value using the boolean type.
- Integer – explain to you how to work with integers in PHP.
- Float – guide you on how to represent floating-point numbers.
- String – learn about various forms of strings in PHP, including single-quoted and double-quoted strings.
- Null – introduce to you the NULL type and how to check if a variable is NULL or not.
Section 4. Operators
This section cover the most commonly used operators in PHP including logical and comparison operators.
- Assignment operators – learn about the most commonly used assignment operators effectively.
- Comparison operators – introduce to you the comparison operators that allow you to compare two values of the same or different types.
- Logical AND operator (&&) – show you how to use the logical AND operator to build complex logical expressions.
- Logical OR operator (||) – learn how to use the logical OR operator to form complex logical expressions.
- Logical NOT operator (!) – learn how to negate a Boolean expression.
- Operators – explain to you the available operators in PHP and help you apply them effectively.
Section 5. Control flow
- if – learn how to execute a code block based on a condition.
- if-else – show you how to run a code block if a condition is
trueand another code block if the condition is
- if-elseif – show you how to execute the corresponding code block based on multiple conditions.
- Ternary operator – guide you on using the ternary operator to make your code shorter and more readable.
- switch – learn how to use the switch statement effectively.
- for – execute a code block a fixed number of times.
- while – explain to you how to run a pretest loop.
- do-while – understand the posttest loop and learn when to use it in the script.
- break – learn how to break out of a loop.
- continue – show you how to skip the current loop iteration and start the new one from the beginning.
Section 6. Functions
- Functions – a quick introduction to the functions
- Function parameters – learn about function parameters, passing arguments by value, and passing arguments by reference.
- Default parameters – show you how to set a default value for a parameter.
- Named arguments – explain to you the named arguments that allow you to pass arguments to a function using the parameter names rather than parameter positions.
- Variable scopes – learn about the variable scopes, including global, local, static, and function parameters.
Section 7. Array
- Arrays – show you how to handle a list of items effectively with Array data type.
- Associative Arrays – learn how to use the associative arrays to reference elements by names rather than numbers.
- foreach – show you how to use the foreach statement to iterate over elements of an index array or an associative array.
- Multidimensional Array – guide you on how to define a multidimensional array and manipulate its elements effectively.
- array_unshift() – add one or more elements to the beginning of an array.
- array_push() – add one or more elements to the end of an array.
- array_pop() – remove an element from the end of an array and return it.
- array_shift() – remove an element from the beginning of an array and return it.
- Filtering array elements – learn how to filter elements in an array using array_filter() function.
Section 10. Encapsulation
- Objects – learn the basic concepts of OOP including objects and classes.
- The $this keyword – help you understand PHP
$thiskeyword and how to use it effectively.
- Access Modifiers: public vs. private – explain to you the access modifiers in PHP and help you understand the differences between the
- Constructor – explain to you the constructor concept and how to use it to initialize attributes.
- Magic Methods – learn how the magic methods work in PHP.
- Cloning Object – show you how to copy an object.
- Comparing Objects – learn how to compare two objects.
Section 11. Inheritance
- Inheritance – learn how to extends a class for code reuse.
- Call the parent constructor – show you how to call the parent constructor from a child class’s constructor.
- Overriding method – guide you on how to override a parent class’s method in the child class.
- Protected Access Modifier – explain the protected access modifier and how to use protected properties and methods effectively.
Section 12. Polymorphism
- Abstract Class – guide you on abstract classes and how to use them effectively.
- Interface – explain to you the interface concept and how to create interfaces.
- Polymorphism – explain the polymorphism concept and show you how to implement polymorphism in PHP using abstract classes or interfaces.
- Traits – introduce you to traits.
Section 13. Static methods & properties
Section 14. Exception Handling
- try…catch – show you how to use the try…catch statement to handle exceptions that may occur in your script.
- try…catch…finally – learn how to clean up the resources when an error occurs using the finally block.
- Throw an exception – guide you on how to throw an exception using the throw statement.
- Set an Exception Handler – show you how to use the set_exception_handler function to set a global exception handler to catch the uncaught exceptions.
Section 16. Processing Forms
- PHP form – show you how to process HTML forms.
- Form validation – walk you through the step of validating a form in PHP.
- Checkbox – learn how to process checkboxes.
- Radio button – learn how to handle radio buttons and radio groups.
- Select – show you how to handle the select element.
- File Upload– guide you on how to upload a file to the server.
Section 17. File I/O
- Managing Files – learn how to use file function to manipulate files effectively.
- Create New Files – show you how to create new files.
- Check Files Exist – show you how to check if a file exists
- Copy, Rename and Delete Files – learn how to manipulating files including copying, renaming, and deleting files.
- File Permissions – explain to you the file permissions.
- Create and Read CSV Files – learn how to create and read CSV files in PHP.
- Managing Directory – show you how to manage directories in PHP.
Section 18. Working with database
- Introduction to PHP Data Objects (PDO) – provide you with a quick overview of PHP Data Object, which is a standard interface for interacting with databases.
- Connect to MySQL – show you how to connect to the MySQL database server.
- Connect to PostgreSQL – learn how to connect to the PostgreSQL database server.
- Create a new table – guide you on how to create a new table in the database using PHP PDO.