
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore PHP as a web language, its wide adoption and performance improvements. Understand security considerations, best practices, and MVC concepts, plus course resources like an e-book and exercises.
Set up a PHP development environment using Replit, compare local and production setups, and run a hello world application.
Explore how PHP, an open source general purpose scripting language for web applications, is interpreted by the PHP interpreter, translating code line by line into machine code.
Create a PHP file, run it through the PHP interpreter on a server, and view the resulting HTML output, including dynamic pages like index.php and about.php.
Add the php tags at the top of the file to enter php mode, so the interpreter executes instructions, and place php blocks inside html to generate dynamic content.
Learn the echo keyword in PHP, how to output text with quotes and semicolons, understand statements and tag embedding, and practice wrapping output with h1 tags.
Learn how PHP handles comments and document your code using //, /* */ and #, which are ignored by the interpreter, to add notes as you write code.
Master PHP variables to store data, starting with a dollar sign, using descriptive names and consistent casing, learn camel, Pascal, and snake case conventions with total price and cust name.
Master the assignment operator to store values in variables, update them like age, echo results, note that numbers don't need quotes, and watch for case sensitivity and typos.
Discover how PHP data types organize data with variables, why the right type matters for performance and debugging, and that PHP is dynamically typed with nine data types.
Discover how PHP functions differ from keywords, why some can be disabled, and how to use var_dump to output a value with its data type for debugging.
Explore the null data type, representing nothing, and learn how explicitly initializing a variable with null avoids undefined variable warnings and keeps PHP code reliable.
Explore the boolean data type, which stores truthy or falsy values to decide if actions can run, such as the is_logged_in status guiding a checkout.
Explore integers and floats in PHP, learn how memory efficiency shapes their use, and see how negative values, decimal places, and underscore separators affect readability.
Explore strings in PHP, the text data type, wrapped in quotes. Learn interpolation with double quotes, variable injection, and indexing to access and update characters, using curly braces when appending.
Create and manipulate arrays in PHP to store lists of values, such as favorite foods. Use square brackets, zero-based indexing, and appending new items to update, view, and extend arrays.
Explore associative arrays in PHP by using named keys instead of numbers to describe values. Learn to reference items by name and maintain consistency with key-based indexing.
Explore multidimensional arrays and nested arrays in PHP, learn to store multiple values per item, access nested elements with square brackets, and handle missing keys.
Explore PHP typecasting by converting values to boolean, integer, float, string, and array with practical examples; learn how non-numeric characters, zero, and null affect results.
Explore type juggling, or type coercion, in PHP as values are automatically converted between data types. Learn how this convenience can cause unexpected results and affect data handling.
Explore arithmetic operators in PHP—addition, subtraction, multiplication, division, modulo, and exponentiation—while practicing order of operations and using parentheses to change results.
Explore assignment operators in PHP, see a documentation page for the complete list, learn shorthand forms for arithmetic operations, and update a data variable using compound assignment.
Learn PHP comparison operators, including features like boolean results, type juggling, and strict comparisons with === and !==, plus not equals and relational operators such as <, >, <=, >=.
Learn how to suppress errors in PHP with the error control operator, and see why it should be used sparingly to avoid warnings when typecasting an array to a string.
Learn how the increment and decrement operators update numbers by one in PHP, using data ++ and data --, and note how placement before or after the variable changes output.
Master logical operators in PHP to perform multiple comparisons, such as checking ages between 18 and 65. Define age and permission variables, and practice or not operators to evaluate outcomes.
Explore PHP operator precedence and associativity, using the precedence table and parentheses to refine evaluation order, and compare and/or variations with their higher-precedence forms to avoid gotchas.
Explore constants in PHP, learning how they remain read-only, how to declare them with const, and why they help secure scripts across multiple files, using uppercase naming conventions.
Explore string concatenation in PHP as an alternative to interpolation, using the dot operator and concatenation assignment to combine constants and strings, fix spacing, and compare with interpolation.
Learn the PHP terminology of expressions and operators, and how code lines evaluate to values, including variables, assignments, and the echo keyword.
Learn PHP control flow with conditional statements like if, else, and else if, using boolean expressions, type juggling, and comparison operators to drive gated pages and privileges.
Explore how switch statements in PHP control logic by matching values with cases and default, using break to prevent fall-through, and understanding type juggling and when to prefer if statements.
Explore PHP 8's match expressions, a value-producing alternative to switch statements, and learn how strict type matching and a default case prevent errors.
Define and invoke a custom PHP function to provide payment status, illustrating function syntax, camel casing, and the rule to define before invoking and avoid double definitions.
Enhance php function flexibility by adding parameters to avoid hard coding. Pass values, use defaults, and distinguish parameters from arguments to prepare for return values.
Expose data from a function to outside sources by returning a value with the return keyword, then store and render that value for flexible messages.
Apply type hinting to PHP functions, enforce return and parameter types, and explore union types and mixed for robust, debuggable code.
Enable strict typing in PHP by adding declare(strict_types=1) at the top of each file to prevent type juggling, catch type errors, and ensure values match int or float expectations.
Explore how PHP short-circuiting stops evaluating conditional expressions when the first condition is false, so the second condition may not run, enabling performance optimization by skipping expensive functions.
Explore loops in PHP by building a while loop that outputs numbers 1 through 15, then convert to a do-while loop, learning about boolean conditions, incrementing, and avoiding infinite loops.
Master the for loop in PHP by initializing a variable, applying a condition, and incrementing within the loop, and compare it to while loops while learning continue and break.
Master the PHP foreach loop to iterate over arrays, access each item with the as keyword, and optionally retrieve the key, using simple examples and array handling.
Tackle programming challenges by learning to map resistor color codes to numeric values in PHP, using a lookup function and critical problem-solving steps.
Learn how to implement a PHP function with strict types to map resistor colors to codes using an associative colors array, return the color code, and test the solution.
Learn to implement the toofer function in PHP with strict typing, default parameters, and string interpolation, returning appropriate messages: one for a name, one for me, or one for you.
Explains coding a leap year solution in PHP, detailing the isLeap function that returns true or false based on four-year rules and 100/400 exceptions.
Explore PHP predefined constants, including PHP_VERSION and PHP_INT_MAX, and understand float limits and scientific notation. Examine magic constants like __LINE__, __FILE__, and __DIR__, and how their values vary by context.
Compare the define function and the const keyword for creating PHP constants, and learn to use them in conditionals and classes while using defined to check constants before redefining.
Learn how to free memory in PHP with unset, delete variables and array items, understand zero-based indexing, reindex arrays with array_values, and compare print_r versus var_dump output.
Explore how to read the PHP documentation and navigate the functions reference. Focus on parameters, return types, and version compatibility, and bookmark the manual for future use.
Learn to round numbers in PHP with floor, ceil, and round, compare typecasting versus rounding, and gain precision for currencies while reading PHP documentation on union types and default values.
Explore the alternative PHP conditional syntax with colon and endif, illustrated by a permission-based hello to admin, mod, and guest, highlighting readability versus curly braces.
Optimize PHP code by avoiding repeating function calls in conditions and loops, caching results or using switch statements to run the function once and speed up page loading.
Learn to split a PHP project into reusable files with include, include once, require, and require once. Manage navigation, handle errors, and return data from includes.
Learn to build flexible PHP functions using the spread (variadic) operator to accept unlimited numbers, implement a sum function, and handle arrays of integers and floats.
Explore named arguments in PHP 8, passing values by parameter name to reorder calls, improve readability, and skip optional parameters in functions with many arguments, with practical examples.
Explore scope and global variables in php, including how include, function scope, and the global keyword affect accessibility. Learn to replace globals with parameters and return values for reliability.
Explore static variables in PHP, showing how normal variables reset after a function runs, while static variables retain values between calls, improving script efficiency with the static keyword.
Explore anonymous functions in PHP, store and swap them as variables, pass them as callbacks, and learn PHP 7.4 arrow functions with use and a single expression.
Explore the callable type as the proper parameter for storing and passing functions as callbacks in PHP, demonstrated with the sum function and multiple ways to pass a function.
Learn how to pass a value by reference in PHP, compare pass by value and pass by reference, and see how ampersand enables modifying the original variable through functions.
Explore common PHP array functions for handling lists, including is set, array key exists, array filter, array map, and array merge.
Master destructuring arrays to improve readability by extracting values into variables with the list keyword or square bracket syntax, including key-based destructuring for specific keys.
Learn PHP file system functions, including scan directory, mk directory, rm directory, file exists, file size, file put contents, clear stat cache, and file get contents, with examples.
Explore tougher PHP challenges by using hints, researching undocumented functions, and mastering how to search PHP documentation to generate a robot name and tackle series exercises.
Generate a random robot name by combining two uppercase letters from A to Z with a three-digit number, using range, shuffle, and mt_rand.
Explore solving the Armstrong numbers challenge in PHP by implementing a function that checks if a number is an Armstrong number using string splitting, array_map, and a digit-power sum comparison.
Create a PHP function that builds overlapping digit groups from a numeric string using string length and substring, with validation to return an empty array when the size is invalid.
Explore the object oriented programming paradigm, its separation of concerns, and how objects organize code for reusability, contrasting it with procedural and functional approaches in PHP.
Define what a class is and how it serves as a blueprint for creating objects in PHP, instantiated with the new keyword; understand objects, instances, and Pascal casing.
Add and manage class properties with public access modifiers to control where data can be read or updated, while each instance maintains its own values with types and default settings.
Explore PHP magic methods, focusing on construct, a method automatically called on instantiation to initialize name and balance using the this keyword and passed arguments.
Discover constructor property promotion in PHP 8, a shorthand that turns constructor parameters into class properties with values assigned automatically. Learn when to use it or define properties separately.
Define custom methods inside a class with a public deposit function that updates the balance using $this and supports method chaining, demonstrated in the account class and index dot php.
Explore how the null safe operator prevents errors when accessing methods on potentially null objects in PHP 8, avoiding repeated isset checks.
Understand how namespaces in PHP are optional yet heavily adopted, acting as virtual folders to organize code and prevent naming conflicts in medium to large projects.
Create and name a PHP namespace, import it with use app\account, and instantiate the class while handling namespace awareness and error resolution.
Explore namespace basics, folder structure, and how to update require statements for a cleaner app. Import classes with aliases and handle global DateTime namespace, or import multiple classes with braces.
Learn to autoload PHP classes using SPL autoload register with an anonymous function, replace backslashes, build a full file path, and load class files automatically while aligning namespaces with directories.
Learn how to define constants in PHP classes with the const keyword, set access modifiers, and read them via the scope resolution operator without instantiating objects.
Learn how to define and use static properties and static methods in PHP, access them with the self scope resolution operator, and understand their role alongside constants.
Explore encapsulation in object oriented programming by restricting data to a class, using private properties, and implementing getters and setters to control access and update balance.
abstraction hides complex details from users by exposing simple interfaces, letting a class perform steps internally, such as connecting a social account or updating balance while the user provides input.
Explore inheritance in PHP by extending a parent toaster class to build a premium model with four slots, reuse the toast behavior, and understand how the this keyword works.
Explore the protected modifier by refactoring the toaster class's slots property to show how protected balances access for parent and derived classes, while private blocks external updates.
Learn how to override methods in inheritance with a toaster premium class, manage a duration property, call parent methods, and explore is-a relationships and the final keyword.
Explore abstract classes and methods, including implementation and base templates, and learn how they prevent instantiation and require public or protected methods like setup to improve debugging and developer experience.
Explore how PHP interfaces, similar to abstract classes, enforce method definitions across restaurant classes, implement an interface in a class, and define a prepare food method for diverse cooking methods.
Explore polymorphism in PHP by using an interface as a flexible data type, allowing multiple restaurant classes to feed a single food app, and compare abstract classes with interfaces.
Explore anonymous classes in PHP, defining classes without a name that support regular class features, implement interfaces, and accept constructor data; discover their use for prototyping, testing, and lightweight scenarios.
Explore doc blocks, a formatted PHP comment for documenting classes, properties, and methods, and how editors read them to understand code, parameters, and returns.
Learn to throw and catch exceptions in PHP using the throw keyword, create custom messages, and use specific exception classes like invalid argument exception to control error handling and debugging.
Create a custom exception by extending the PHP exception class, override the protected message, and catch it to customize error handling across your app.
Master catching exceptions in PHP using try and catch, with multiple exceptions and a finally block. Handle errors gracefully by displaying messages or redirects.
Explore the date time class in PHP by creating date time objects, setting time zones with the date time zone class, and formatting dates with placeholders, plus the Carbon library.
Learn to loop through objects with for each by implementing PHP's iterator interface in a current week class; define current, key, next, rewind, and valid to display days this week.
Navigate two PHP exercises in the OOP challenges overview, using hints and solutions to explore the nullish coalescing operator and other operators, while reading documentation to implement solutions.
Implement a static PHP method to count A, C, G, and T in a DNA sequence using substr_count and an associative array to return nucleotide counts.
Develop a PHP grade school roster system that adds students to a specific grade, retrieves grade rosters, and returns a complete, ascending, alphabetically ordered list of grades and students.
Build an expense tracking app while learning to write scalable, maintainable code, within one project that hosts two projects—an application and a portable custom framework.
Set up a local PHP development environment by choosing a text editor, installing Visual Studio Code, adding the PHP IntelliSense extension, and personalizing with a theme like Shades of Purple.
Understand the lamp stack for php development, including linux, apache, mysql or mariadb, and php, plus environment concepts and the lamp vs lamp distinction.
Explore the AMP control panel, start Apache and MySQL to run the web server and database, and review extra modules like Filezilla, Mercury, and Tomcat, plus PHP integration via Apache.
Create the master expense tracker project in a local xampp setup, organizing files under the htdocs piggy folder with a public index.php and a secret file to test access control.
Configure Apache virtual hosts to map a custom domain to a site directory, set document root and server name, restart Apache, and update the hosts file to route local requests.
Discover how to view and adjust PHP configuration with phpinfo, the php.ini file, and ini_set, including memory limits and per-script versus system-wide changes.
Develop a modular framework by creating an application class that acts as the glue for routing, form validation, database interaction, compiling templates, and a container for injection.
Bootstrap an application by creating a dedicated bootstrap file that loads the framework, instantiates the app class, and starts the run process from the index file, preparing for auto loading.
Learn the command line essentials for PHP development, including navigating directories with pwd, ls, and cd, using PowerShell or Terminal, and starting with Composer for auto loading.
Learn PHP standards and how PSR guides code formatting and autoloading; use Composer to auto load classes according to PSR-4 for consistent, collaborative projects.
Install and verify composer, the PHP dependency manager, to download packages with their dependencies, verify compatibility, and enable auto loading in your projects from the community repository.
Learn json basics as a simple data storage format inspired by JavaScript, using objects, key value format, strings, numbers, booleans, arrays, and nested objects; explore syntax in a playground.
Learn how to initialize Composer in your project, generate composer.json with questionnaire prompts, set project name, description, author, type, and understand production and development dependencies.
Configure PSR-4 autoloading in composer.json, add the framework and app namespaces with their directories, run composer dump-autoload, and verify autoloads in the vendor autoloader.
Load composer files via the bootstrap using require to include vendor/autoload.php. Autoloading with PSR-4 lets composer handle file inclusion, improving readability and setting up the Git discussion for next lecture.
Learn how Git tracks changes in a repository, why version control matters for collaboration, and how GitHub hosts code and supports reverting to older versions.
Use the GitHub desktop app to upload your PHP project, skipping the command line; create a repository, delete vendor, add readme and license, then publish or share as a gist.
Explore git attributes for line endings and the gitignore setup to exclude the vendor folder, then commit and sync changes with GitHub while using composer dump-autoload to regenerate dependencies.
Explore routing fundamentals by defining resources and routers, compare file-based routing with dynamic URLs, and learn why a custom router is needed, starting with modifying Apache configuration.
Enable mod_rewrite in Apache within a virtual host to route all non-existent files to index.php, using rewrite conditions and rules to let PHP handle routing.
Discover how htaccess files configure per-directory settings in Apache, and compare them with the main configuration. Enable or disable overrides and consider performance implications while experimenting with routing.
Create a sugar function to dump any value for debugging, move the logic to functions.php, include it manually, and call the function to stop page rendering for faster debugging.
Create a standalone router class within the framework to register and dispatch routes, initialize it from the application class, and expose a private router property for testing.
Add support for custom routes by expanding the router with a routes list and an add method, and expose a public add in the application class to register path routes.
Learn how http methods describe actions on resources and name routes by resource rather than action. Use get, post, delete, and patch, and verify methods with browser dev tools.
Update the router to store http methods by adding a method parameter and saving strtoupper(method); refactor app and bootstrap to use get routes and test in the browser.
Normalize routes by standardizing path formats with leading and trailing forward slashes. Implement a private normalize path method that trims excess slashes to ensure consistent routing.
Learn to use regular expressions in PHP to remove duplicate consecutive forward slashes from paths, test patterns on Regular Expression 101, and understand delimiters and quantifiers for robust string handling.
Apply regular expressions in the router class to normalize paths, replacing consecutive slashes with a single slash using the pregreplace function. Verify routes in bootstrap for consistent path normalization.
Explore the MVC design pattern and separation of concerns, showing how the router delegates to a controller that coordinates model and view to render pages.
Create the first mvc controller by adding a home controller class in app/controllers with a home method, namespace app\controllers, and a home page echo, then register with the router.
Register a controller with a route and let router instantiate it on demand using class name with namespace and home method, updating get method to accept a controller array.
Use PHP 8's ::class to get a class name as a string, import the home controller, and pass the class name in the bootstrap router to avoid typos.
Dispatches a route by collecting path and method from the server request, normalizing the path, uppercasing the method, and dispatching via the router in the application.
Search routes with regular expressions in a PHP router, looping through routes and matching path and method to render a page when a match occurs.
Learn to instantiate a controller from the root using a class name and method sourced from the router, then render path-based content through an MVC pattern for maintainable code.
Enable PSR‑12 auto formatting in PHP editors, using VS Code with PHP IntelliSense formatter to format on save and place braces on new lines, following PSR‑12 and PSR‑1 guidelines.
Updated to use PHP 8
PHP is one of the most popular programming languages in the world. It powers the entire modern web. It provides millions of high-paying jobs all over the world.
That's why you want to learn PHP too. And you came to the right place!
Why is this the right PHP course for you?
This is the most complete and in-depth PHP course on Udemy (and maybe the entire internet!). It's an all-in-one package that will take you from the very fundamentals of PHP, all the way to building modern applications.
You will learn modern PHP from the very beginning, step-by-step. I will guide you through practical and fun code examples, important theory about how PHP works behind the scenes, and a beautiful and complete project.
You will become ready to continue learning advanced back-end frameworks like Symfony, Laravel, Code Igniter, or Slim.
You will also learn how to think like a developer, how to plan application features, how to architect your code, how to debug code, and a lot of other real-world skills that you will need in your developer job.
And unlike other courses, this one actually contains beginner, intermediate, advanced, and even expert topics, so you don't have to buy any other course in order to master PHP from the ground up!
By the end of the course, you will have the knowledge and confidence that you need in order to ace your job interviews and become a professional developer.
So what exactly is covered in the course?
Build a beautiful real-world project for your portfolio! In this project, you will learn how to plan and architect your applications using flowcharts and common PHP patterns
Master the PHP fundamentals: variables, if/else, operators, boolean logic, functions, arrays, objects, loops, strings, and more
Learn modern PHP 8 from the beginning: arrow functions, destructuring, spread operator, variadic arguments, nullish coalesing operator, and more
Deep dive into object-oriented programming: encapsulation, abstraction, inheritance, and polymorphism. This section is like a small standalone course.
Dive deep into design patterns: MVC, singleton pattern, factory pattern, dependency injection, and PSR concepts.
Learn modern tools that are used by professional web developers: Composer and Packagist
Check out the course curriculum for an even more detailed overview of the content :)
This is what's also included in the package:
Up-to-date HD-quality videos, that are easy to search and reference
Downloadable starter code and final code for each section
Downloadable free eBook with summaries of the core concepts taught in each section.
Free support in the course Q&A
Coding challenges with solutions included.
This course is for you if
You want to gain a true and deep understanding of PHP
You have been trying to learn PHP but still don't really understand PHP, or still don't feel confident to code real apps
You are interested in using a library/framework like Symfony, Laravel, Slim, or Code Igniter in the future
You already know PHP and are looking for an advanced course. This course includes expert topics!
You want to get started with programming, PHP is a great first language!
Does any of these look like you? If so, then start this adventure today, and join me and thousands of other developers in the only PHP course that you will ever need!