Lately, there have been several people asking "What is the best way to learn PHP?", and while we don't mind helping you, it is starting to become a little repetitive.First thing first, PHP is NOT easy to master, however it is easy to learn. The difference is that in NO way will you be making an online game in PHP as soon as you start learning it. Games are incredibly complex, and take a lot of time, work, and determination to finish. I have Started about five games, and only one of them is up and still being worked on.
Before everything else, if you really want to learn PHP, you will learn it by doing. Fist off, you will need some type of hosting.
1.1 Free Hosting
As there is plenty of free hosting out there, That may be the way to go, and it has several advantages and disadvantages.
- It's Free
- It's accessible from the Web, meaning people can help you, see error pages that occur, Etc.
- No need to use up Disk Space on your computer for something such as WAMP (detailed later on)
- Most of the sites usually have great restrictions (IE: possible advertising, irremovable footers, HUGE limits on BandWidth)
- If the server encounters a problem, don't expect a letter to them to do anything. They offer it to you free, and therefore don't "need" to keep it up for you.
1.2 Dedicated ServerAdvantages
- Servers usually have 99.9% uptime guaranteed (meaning they will reimburse you if they're down too long)
- PHP and MySQL are usually included in the package
- If something happens, chances are they are already at work fixing it for you
- Costs to host (though generally cheap)
1.3 Local Machine Server
Yes, it IS possible to install Apache, PHP, and MySQL onto your PC, regardless of if it is Linux, Windows, or other.
- You can control all of the options of PHP, MySQL, AND Apache, involving things such as Mod-Rewrite
- No external provider to deal with
- 100% uptime when you need it, All you need to do is turn it on, and it works if you installed it correctly
- Uses internal Disk Space (not a lot, but enough to mention)
- Large operations may take a while to work with, as it is limited by your CPU and RAM (though generally not a BIG disadvantage, it does occur sometimes on very intense calculations)
PHPDock is generally overlooked, as I don't think many people know about it. It enables you to build a PHP website, and deploy it with NO internet connection required.
- Used on your general machine
- Can create Desktop Applications in PHP
- Expensive ($149)
- Usually only works well with NuSphere PHPED
- You're forced to use Internet Explorer to view them
Learning PHP is a delicate process. What you learn, and the way you learn it, influences how you code. That is why it is crucial that you learn it correctly. My suggestion is to go with W3Schools AND Tizag (yes, I said read both).
W3Schools is where I learned PHP. I still use it when i forget a function or need to look it up. It has a plain basic interface, nothing special, but the knowledge it contains is very helpful, and will lead you towards the right path to programming.
Tizag is one of the favorites here at DIC, and provides very in-depth, easy to understand tutorials. Their no-frills website has several things about PHP that will help you in the long run.
There are several PHP learning sites out there. Zend is the company that offers the Send PHP Certification, something you may become interested in getting if your job requires it. LearnPHP.org Has several tutorials that I don't even think DIC has. They go in-depth to several CMS (Content Management Systems), something you may find useful. About.com is another good site for learning, and offers some well written tutorials.
Ok, so now that you have something that can run PHP, and you have begun learning it, the next step is programming it.
3.1 Integrated Development EnvironmentAdvantages:
- Shows errors in the code along with readable error codes
- Installs PHP onto your machine
- Applications can be tested by hitting a "run" command
- Usually show complete error messages on the run tab (IE: Error and Line on which the error occured)
- Expensive. NuSphere PHPED costs $495.00 for the professional version, and if you're just starting, you might not want to spend any money at all.
Yes, Notepad can make PHP Files! All you need to do is save it as .php.
- Already installed on your system (for Windows Users. For Mac and other users, there should be a similar program)
- No error handling
- No Debugging
- Manually have to indent/align your code
- No highlighting or code Folding
Notepad++ is a completely Free PHP Editor. It offer code highlighting and folding, as well as editors for several languages.
- Small Size
- has a VERY large list of Plugins to increase functionality
- There are a few bugs, but they're few and far between
4.1 The giant PHP List of Common Problems
DIC Has several things that you should read if you want to learn php.
I created The giant PHP List of Common Problems to help people with their problems. Most that occur are simple issues, such as wrong Logic, and problems with things such as Headers and Sessions.Link:
The giant PHP List of Common Problems4.2 PHP Tutorials
DIC Has several tutorials in their tutorial section built specifically to help you understand PHP. They have basic ones (such as simple login scripts) to more advanced ones (like building a complete CMS).Link:
PHP Tutorials4.3 How to get better help on DIC
"How to get better help on DIC" is a guide written by Akozlik. It details common problems that occur when posting on DIC, and how to request the help that you actually need. Many people don't clearly state what it is they need help with, and we shouldn't be expected to read through your entire code looking for errors that we don't know exist.Link:
How to get better help on DIC4.4 The PHP Forum
If you need help, don't be afraid to ask! We're here to help you, so long as you help us help you. No cryptic messages, your best English (though we understand not everyone speaks perfect English, and many have it as a second language), and Provide your Code.DIC Is here to help you help yourself, not to hand everything to you.Link: