Find Your First PHP Lesson
Pick the description that fits you. Each path starts with one lesson and gives you something to try straight away.
New to programming
Section titled “New to programming”Start with Write and Run Your First PHP Script. Open its browser example, change the greeting, and run it again. You’ve written your first PHP instruction when the output shows your new greeting.
To try it on your machine, install PHP and repeat the exercise in your terminal. When you’re ready for a small project, follow the PHP and SQLite reading list starter.
If you already build static pages, try PHP for HTML and CSS developers. There is also a first PHP script in Spanish.
Switching from another language
Section titled “Switching from another language”Choose a lesson for a language you know. Pick one side-by-side example, run the PHP version, and change an input to see how it behaves. If you need PHP on your machine, start with the setup instructions.
| You know | Start with |
|---|---|
| JavaScript or TypeScript | Compare the PHP and TypeScript type systems |
| Python | Translate familiar Python syntax into PHP |
| Ruby or Rails | Compare Ruby and PHP syntax |
| Java | Write your first PHP script alongside Java |
| Another language | Call a function with a parameter and use its return value |
Returning to PHP
Section titled “Returning to PHP”Try Can PHP Be Typed?. Run the example that passes a numeric string to a typed function, then compare the default and strict results. It’s a short way to see what modern PHP enforces at runtime.
If you’re picking up an existing project, run php -v in the shell or container where that project runs. Use the PHP 8.5 to 8.6 upgrade checklist if that’s your next upgrade.
For more practice, try the seven-day PHP starter plan or explore the PHP resource library. If you already know what you want to build, browse all PHP courses.