**tell me the best source to learn php **

Dani AI

Generated

A single “best” source rarely exists for a language like PHP. A reliable approach combines a short, structured course to learn syntax, a solid reference for lookups, and—most important—small, real projects that force problem solving. That aligns with points already made here: and emphasize interactive practice, while and highlight the value of complementing tutorials with a vetted book. The recommendation is to treat those three lanes as a single workflow rather than chasing one perfect tutorial.

A practical learning path: set up a local environment (XAMPP/MAMP or PHP’s built-in server), cover syntax and flows (variables, arrays, control structures, functions), then move to web concepts (forms, sessions, cookies), databases (use PDO with prepared statements), and basic OOP. Progress to dependency management, autoloading, coding standards (PSR), and testing. Small, focused projects build confidence: a guestbook, a simple task API, and an auth system. Example of a minimal PDO insert with password hashing:

<?php
$pdo = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8mb4', 'user', 'pass', [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
]);

$stmt = $pdo->prepare('INSERT INTO users (email, password) VALUES (:email, :password)');
$stmt->execute([
    ':email' => $email,
    ':password' => password_hash($plainPassword, PASSWORD_DEFAULT),
]);

Troubleshooting and habits that pay off: enable full error reporting during development, use a debugger (Xdebug) for stepping through code, keep code in version control (git), and add static analysis/unit tests gradually (PHPUnit, PHPStan/Psalm). Security reminders: never trust user input, always use prepared statements, and never display raw errors in production.

Combining these practices with the tutorial/book suggestions already offered in the thread produces steady, practical progress — learning by building and fixing real problems will teach far more than passive reading alone.

Recommended Answers

All 4 Replies

One of the best sites to learn about the web is http://www.w3schools.com/php/default.asp
It s incredible i learned HTML, CSS, SQL, XML, learningn javascript...
It gives you a good understanding and you can also text your own code overthere without having a program installed on you harddrive.
So once again you will get a decent knowledge about php but after that in order to fully understand what s going on you will have to program by yourself and create some applications.

commented: agreed +3

you can easily find decent and good php tutorials with just a few search by yourself
and if there are some other things that you can't understand you're always welcome to post a thread here

Member Avatar for Member #120589

Buy a book or two. Books are peer-reviewed and edited by experts, online resources usually aren't. However, they can become out of date with each new release of php, but the basics should be the same. Good publishers include Wrox, Apress, and O'Reilly.

I hate to rubbish anything, but be very careful with w3schools, it still contains a few errors.
The php.net manual is an essential reference for almost everything, although some functions are poorly documented, but even those should have some user-based examples of use.

Buy Head First PHP & MySQL or PHP Complte Reference.
These 2 Books are awesome to learn php.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.