Start learning PHP — Useful resources for beginners and advanced!
If you're wondering where to start from learning the PHP language or needing some more knowledge to deep dive into the language, you are on the right place!
I want to share with you some links with useful materials to start learning. All you need is the motivation to learn and go ahead!
Similar collections of learning links
Official PHP documentation is also good
Other sources:
- PHP. The Right Way
- Free interactive PHP tutorial* (learn-php.org)
- PHP Best Practices
- Learn PHP in Y minutes
- PHP Freaks Forum (friendly to new PHP developers).
Books
- PHP & MySQL by Jon Duckett features best and modern practices, guides you from very basics to creation of a full-featured application!
Editors/IDE
Video Courses
Some people prefer learning from videos, though be warned that most tutorials found on Youtube are of questionable quality. There are some quality tutorials though:
- PHP For Beginners from Laracasts
- PHP Track from Symfonycasts
- Program with Gio
- Learn Object Oriented PHP (Gary Clark)
And some cheat sheets in order to get some code started:
- Modern PHP Cheatsheet
- Quick Reference (covers PHP, Laravel, and PhpStorm)
How to install PHP on different OS
Windows:
The simplest way to start working with PHP on Windows would be
- download the zip archive from the topmost link labeled
zip
on this page - unpack it in
C:\PHP
folder - start running your php scripts in console right away, with
C:\PHP\php your_script.php
- run a web server by opening a Windows console and typing
C:\PHP\php -S localhost:80 -t C:\WEBSITE
whereC:\WEBSITE
is a folder where your site would be. Then just openhttp://localhost/
in your browser
- download the zip archive from the topmost link labeled
Or you could try a bundled software pack such as MAMP, XAMPP, WampServer and such.
Or if your requirement is using IIS, then you could try IIS and PHP
Or install Docker and use one of the Docker environments listed below
Linux (Ubuntu):
macOS:
docker (OS independent):
You can find some useful Stack Overflow question and answers/tutorials here:
PHP guides, introduction and others
- Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
- Difference between require, include, require_once and include_once?
- Detecting request type in PHP (GET, POST, PUT or DELETE)
- Secure hash and salt for PHP passwords
- How do I pass variables and data from PHP to JavaScript?
- What is the difference between single-quoted and double-quoted strings in PHP?
PHP and Databases
- Why shouldn't I use mysql_* functions in PHP?
- How do I get the current date and time in PHP?
- How can I prevent SQL injection in PHP?
- How does PHP 'foreach' actually work?
- UTF-8 all the way through
- How to include a PHP variable inside a MySQL statement
PHP Arrays
- Get the first element of an array
- Deleting an element from an array in PHP
- How to check if PHP array is associative or sequential?
- Convert a PHP object to an associative array
- PHP array delete by value (not key)
- Remove empty array elements
- How to Sort a Multi-dimensional Array by Value
- How to convert an array to object in PHP?
- How to get the last element of an array without deleting it?
- Sort array of objects by one property
Object-Oriented Programming
Dates and Time
Common Errors/Error Handling
- Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted
- How do I get PHP errors to display?
- How can I get useful error messages in PHP?
- How to fix "Headers already sent" error in PHP
Others
- Enumerations on PHP
- PHP random string generator
- Returning JSON from a PHP Script
- When should I use 'self' over '$this'?
- How do I convert a string to a number in PHP?
- How can I get a file's extension in PHP?
- How can I sanitize user input with PHP?
And last but not least—with only reading, nothing happens. Watch, read, and exercise! Do some projects and practice, practice, practice and it will get easier and easier to learn new things from the examples.
Cheers and wish you the motivation to learn and deep dive into it!
what to read
i would personally suggest this book PHP Objects, Patterns, and Practice quite helpful in terms of OOP and Patterns understanding.