Not too long ago, Jeffrey wrote an excellent article on resources to get you started with jQuery. Now its time to give some love back to the server side, and become more familiar with PHP.
PHP is a scripting language that is perfect for developing dynamic web pages and applications. You may be a PHP ninja, or perhaps you don't even know what PHP stands for. However, if you plan on or are involved in any kind of web development, you are bound to run into this fantastic and easy to learn web language. Today we will review 25 resources to get you started with PHP.
So what the heck is PHP?
Straight from the manual, PHP is "a general-purpose scripting language that is especially suited for web development and can be embedded into HTML." PHP is a server side scripting language, meaning all data is interpreted and sent to the browser before the web page is loaded. This is the exact opposite of Javascript, which we call a client side language. All you need to keep in mind is that PHP is a web language that operates and runs on the server side. Next we will study the advantages of PHP and basic syntax before diving into to various resources.
What are some advantages of using PHP?
Every web language comes with its advantages and disadvantages, and you will find PHP is no different. However, PHP is a popular web language for many reasons.
Easy learning curve. The less time you have to spend searching the manual and studying a web language, the more time you will have to actually create and optimize your application. One of PHP's best features is that it is extremely easy to learn compared to other web languages. The syntax is arguably logical and many of the common functions describe exactly what they do.
Familiar syntax. PHP is a great language for developers with programming experience, especially programming in C and Perl, which is what PHP's syntax is mostly based on. If you know how to program in C and/or Perl, you wont have any issues writing applications in PHP.
Cost. It's free and open source. Can't beat that.
Performance.PHP is a relatively efficient web language. Scalability in your code and applications is very important and you can rely on PHP to serve as many web pages as you need efficiently (of course, it can't help if your coding inefficiently).
Community. The PHP community absolutely rocks. You'll find some of the most in-depth and comprehensive documentation of the entire language at php.net. In addition, there are thousands of PHP help forums and websites to help you when you get stuck. Furthermore, since PHP is open source, it is constantly being improved. PHP 5 recently implemented very strong support for object oriented programming and the language continues to become more powerful.
Overview of the syntax
In case you have been living under a rock and have never seen a PHP script, here is a very basic example of how PHP is written.
1 |
|
2 |
<?php echo "Your first php script!"; ?> |
A few things to note. Notice the opening tags start with <?php and end with ?>. You may see some developers leave off the 'php' after the question mark. This is called using PHP short tags and is considered bad practice, always use full php tags. You will also notice that the line ends with a semi colon, if it does not PHP will throw an error. Now lets move on to some resources to get you started.
Step 1. Download PHP and learn the fundamentals.
First things first, we need to download the latest version of PHP and install it so we can work with it locally.
Visit PHP.net to get the latest version and any libraries you wish.
Recommended Reading
-
Installing PHP on any OS.
Straight from the manual, follow the link below to get started installing PHP on any operating system you happen to be running on.
-
PHP 101-For the absolute beginner.
I still find myself coming back to this article on the zend dev zone. If your new to PHP, this is a must read tutorial/guide.
-
PHP.net-your first script.
Time to get down and dirty with your first php script from the PHP.net manual.
-
Tizag-a complete walkthrough.
Odds are you have visited Tizag.com sometime in your web development career, and you can find a giant section of php tutorials at the link below.
-
Webmonkey-PHP tutorial for beginners.
Webmonkey has an extremely in depth article for those new to PHP, covering everything from variables to functions to loops and operators.
Step 2. Intermediate techniques and MySQL databases.
Now that you have learned the basics and fundamentals of PHP, lets move onto some intermediate techniques and using PHP with MySQL to create dynamic websites. PHP works extremely well with MySQL, which is a database language. Using the two together, we can create nearly any kind of website we wish.
Recommended Reading
-
Installing MySQL and getting started.
This article from the php manual will get you started and show you how to install MySQL and use PHP to interact with the database.
-
PHP-MySQL tutorial.
Everything you need to know about using PHP to interact with your newly setup MySQL database. How appropriate that the site is named "php-mysql-tutorial.com".
-
Tizag-MySQL introduction with PHP.
Tizag takes you through each common MySQL and PHP command needed to get started building database driven websites.
-
User Membership with PHP.
Now that we know how to use PHP and MySQL together, we can create a basic user login script.
-
Secure file upload with PHP.
Uploading files is certainly a great way to add interactivity to your site, but this must be done with caution. Below is a great article on uploading files securely with PHP.
-
Regular expressions introduction.
Using regular expressions is a great way to validate and verify user input to meet your exact needs. Learning the syntax can be a little tricky, so we'll cover a few regular expressions tutorials.
-
A crash course in regular expressions.
Jeffrey delivers with another awesome screencast on using regular expressions.
-
Regular expressions cheat sheet.
Cheat sheets are incredibly useful to any programmer or developer and below you will find an excellent regex cheat sheet that you may download for free.
-
Dev zone security tips.
Security is an important part of your application design so be sure to visit Dev zones' section on security tips.
-
10 PHP security checks.
From O'Reillys dev center comes a list of 10 PHP security checks to make sure you are taking.
Step 3. Advanced and OOP techniques.
Moving right along to what I would consider more advanced PHP techniques, including object oriented programming. OOP has drastically improved since the release of PHP 5.
-
Using the GD library.
The PHP GD library is an image processing library you can install with PHP. The GD library allows you to manipulate images in thousands of different ways.
-
Writing secure php files.
A more advanced and in depth look at creating secure php applications.
-
Introduction to object oriented programming with PHP.
Object oriented programming is a confusing concept to many new programmers, the below tutorial will take you step by step through the basics of OOP.
-
A crash course into object oriented programming.
A slightly more in depth look and study of OOP with PHP.
-
Real world OOP with PHP and MySQL.
Nettuts brings us an excellent real world example of OOP being used to connect and manipulate a MySQL database.
Step 4. Using PHP frameworks.
There are hundreds of PHP frameworks in existence now days, most are based on the MVC approach. Below we have listed some of the better PHP frameworks.
-
CodeIgniter.
One of the most highly praised PHP frameworks, Code Igniter claims a small and powerful footprint to help you quickly develop applications.
-
Symfony Project.
The Symfony Project is a full stack PHP framework built with PHP 5 library classes.
-
Akelos.
Another framework based on MVC, Akelos claims to be a simple ans easy to us PHP framework.
-
Zend framework.
The ever popular Zend framework is an extremely powerful framework with a slightly higher learning curve.
-
CakePHP.
CakePHP might just be the most popular PHP framework around right now. One of the highlights of CakePHP is the fun and easy to understand documentation, which teach you how to "bake your cake".
That'll do it for today's round up. Please let us know if you have any resources or articles we missed in the comments section!