It’s something that will vary from person to person in terms of how long it will take you to learn php. A majority of learning php is trial and error, and occasionally maybe a little help along the way. It’s not something you will be able to learn over night. One thing that you want to make sure of is that you pay attention to how you program. Take the time to learn about common mistakes made in php programming that leave your website/ application vulnerable to security problems.
If you understand the basics of how the language works – how to use functions, how stuff is output – then the rest of it is just memorizing what commands to use for what results.
Couple things that lots of people get hung up on:
… PHP runs **first**, on *the server*.
… once you use PHP, *everything* is PHP. Even plain HTML (outside the `< ?php ?>` tags) is PHP output.
(because of that, I always strive to put all PHP *first* in my scripts, and all output *last* – there are many problems (with sessions, cookies, nice, clean error handling, etc.) you can avoid that way!)
… `die()` **must die**
(many tutorials use `die()` for giving error messages – *don’t!*)
… **never trust user input**. `$_GET`, `$_POST`, `$_COOKIE` – any info you get from your users must be validated (i.e., to make sure it *is* what you *expect*) before use. Sticking it in MySQL queries, emails, HTML output, or almost *any* use in your script can cause serious problems, even if the user is not being intentionally “evil.”
(speaking of MySQL, many tutorials use the `mysql_*()` functions – **they are now deprecated and should not be used**. Learn to use the [mysql**i** extension](//php.net/mysqli) or [PDO](//php.net/PDO) instead!)
You can learn MySQL parallel to PHP, once you start using PDO (or mysqli) you’ll need it.
If you want to be serious with PHP it might be useful to learn the concepts of Object Oriented Programming, and learn a MVC framework (using a good framework will improve your OOP skills if nothing else). But start with basic PHP first.