PHP is one of the most popular scripting languages on the internet today, and one of the easiest to get into. Whether you're a PHP newbie, or an experienced code-slinger, there is always something new to discover. A function you're unfamiliar with a killer timesaving tool, a technique that you forgot about...
Object Oriented PHP
-

Object Oriented PHP for Beginners
Killer PHP teaches the basics of Object Oriented PHP. An easy to follow 5-page guide with videos to go along with the article.
-

PHP for Beginners: Building Your First Simple CMS
Jason Lengstorf shows how to build a very simply object-oriented Content Management System with PHP. While not a ready-to-use solution, due to a few security holes, it nonetheless does a good job at teaching a real-world use for PHP.
-

Learning OOP in PHP ASAP!
An authoritative into to PHP OOP here at NETTUTS. Jo‹o Gradim does a thorough job at explaining the basics of Object Oriented Programming in PHP, with plenty of clear code examples and comments.
Security
-

SQL Injection Prevention
A brief primer on SQL injection and how to counter it.
-

Password Hashing
One of the worst things you can do security-wise is to store users' passwords in plain text. A lot of people use the same passwords on multiple websites, and if someone manages to gain access to your user database, they will have the users' passwords for everything. You should avoid this by encrypting the passwords with some simple PHP functions.
-

Security Corner: SQL Injection
Chris Shiflett explains SQL injection, and covers a few permutations of the exploit, along with instructions on how to prevent it.
-

5 Helpful Tips for Creating Secure PHP Applications
Avoid five of the most common security issues in PHP programs, three of which involve user input. If someone isn't cross-site scripting or injecting SQL, they're reading your error messages to find other ways to exploit your scripts. Don't give those pesky script kiddies any room to sabotage your application.
-

Akismet
Email spam isn't as bad as it once was, thanks to improved filtering technology. Now we have a greater menace: Comment spam. Any site with user-contributed messages, such as a forum or blog, could quickly have hundreds of junk messages, filled with links to questionable sites, added to the comment area. Luckily there is Akismet, a spam filter for just this sort of thing. WordPress blogs can use a simple plugin, and other sites can take advantage of the spam-nuking goodness through an API.
-

ReCAPTCHA
Bots, they're annoying, but what can you do about them? For blog comments, and similar applications, you have the wonderful Akismet filter, but what about other things? You could always use a CAPTCHA, one of those boxes where you enter the jumbled letters shown in an image. ReCAPTCHA provides such a service, with a unique twist. It helps old books be scanned into digital form, using CAPTCHA results to fix words that their computers couldn't read. A user is shown two words, one that ReCAPTCHA knows and one it doesn't, and has the user type both in. If the first word matches, it stores the value the user entered for the second, so the Internet Archive can aggregate the results and automatically figure out what the word is.
-

PHP Short Open Tag: Convenient Shortcut or Short Changing Security?
PHP offers a shortcut for the echo() construct, which looks something like <?=$var?>. It is often used by users of the CodeIgniter framework in Views, as a surrogate for a templating system. Could this convenient shortcut, which depends on short_open_tag being enabled in php.ini, be a security risk? Jeff Starr explains everything.
-

Prepared Statements in PHP and MySQLi
A few years ago, the MySQLi PHP extension was released to improve upon the existing one, known simply as MySQL, like the database software both extensions communicate with. One of the many improvements added was support for prepared statements, a method of querying the database that separates data from the query, which is arguably a more secure way of doing things.
Common Applications
-

PHP Contact Form
Sometimes it's a good idea to have a contact form on your website. It's more convenient than a mailto link, and you don't give out your email address right up front, which can help prevent spam. You can also, with a form, denote fields for mandatory information, which is useful in cases where you need certain information in order to provide an adequate response.
-

User Membership With PHP
User accounts are one the more common components of web applications. Allowing users to register and login isn't as hard as it may seem at first thought.
-

Parse RSS Feeds With SimplePie
RSS Feeds are one of the best things since sliced bread. Not only can you stay up to date with hundreds of websites' content, but you can parse them with PHP. You could, for a basic example, display the headlines from a feed on your website, and link them to the full article. Or you could grab the feeds from your social media profiles and pull them all onto your personal website.
-

How to Dynamically Create Thumbnails
When you deal with large images, it's often necessary to create smaller "thumbnail" versions. In gallery situations, you may want to display a grid of thumbnails that link to the larger versions. In a CMS you might want to have an option to upload an image to go with a post, and have a smaller version for display in certain areas. Such image processing is easily within the capabilities of PHP.
-

PHP Markdown
HTML isn't really the most user-friendly way to style text. Sure, some "ordinary" people know it, but overall the markup language is not something that most people want to mess around with. That's where Markdown comes in. Markdown is a simple method of marking-up text to be formatted a certain way. It uses common conventions such as surrounding a phrase in *asterisks* for italicization, **double-asterisks** for bold text, and > characters for quoting text. It's all easy enough for most people to grasp, especially since many people write plain text like that anyway. PHP Markdown is an implementation of Markdown for PHP. After including the class, you can convert Markdown-formatted text to HTML by passing the string to the Markdown() function.
-

Zebra Stripes
Have you ever noticed how, if you have a long list of data, such as a table showing several data fields, it can be hard to follow a line from one side to the other when you read it? You tend to confuse it with the line below if you're not careful. Zebra striping, despite the amusing name, is a technique that can much improve readability in such situations. In essence, you simply alternate the background color, switching between a light color and one slightly darker one, a simple feat for PHP.
-

Get Started With SimpleXML in PHP
In this "Web 2.0" age, more and more web services are making public APIs available, allowing you to access data from their applications from yours. You could pull messages from Twitter, videos from YouTube, search results from Yahoo, and then aggregate them all into a Facebook application in some manner. Most XML-based APIs can be interacted with through PHP5's SimpleXML functions, with which you can parse output and use as you wish.
-

Caching Dynamic PHP pages easily
If your website is on a shared hosting account, you need to be careful of how much processor power you are using at any given time, especially if you tend to get sizeable amounts of traffic. That's where caching comes in to play. Your web server can send-out pages quicker and more efficiently if it doesn't have to process PHP scripts on every page load. Caching is a technique that temporarily stores scripts' plain HTML output in a directory, and serves them instead of the script to improve performance. Every hour or so, depending on the application, the cache is emptied and replaced with the new output.
Frameworks
-

CodeIgniter
A lightweight and modular Model-View-Controller framework for PHP. Requires little configuration, and no command-line usage. CodeIgniter has plenty of useful classes for functions such as image manipulation, file upload, caching, and database I/O. Compatible with PHP4.
-

CakePHP
Another popular MVC framework. CakePHP is a little heavier than CodeIgniter, but has it's own advantages. It's quite full-featured, having plenty of thorough documentation and an impressive collection of helper classes developed by the community.
-

Symfony
Symfony is a bit harder to use than CakePHP and CodeIgniter, requiring the use of the command-line to run configuration commands and to create applications. While it seems more involved, it is no less of a viable option for those who would feel comfortable with it.
-

Zend Framework
Developed by Zend Technologies, Zend Framework is licensed under the New BSD license. It is along the same lines as CodeIgniter and CakePHP.
-

Flourish
Flourish is an object-oriented PHP framework, but not an MVC one. The library allows for a more free coding structure than other frameworks, being an included library rather than a foundation to build upon. It is supposed to reduce the amount of code required to get things done, but not dictate your file structure.
Screencasts
-

How to Build a Login System for a Simple Website
Build an object-oriented login system as you follow this hour-long tutorial. It's not a complete solution, leaving you plenty of room to expand and make it your own, but by the end of the screencast you should have a good idea of how to build a well-structure login system that will withstand SQL Injection.
-

WordPress as a CMS
WordPress is more than just a blogging tool. It's powerful enough to handle just about anything you throw at it. If functionality you need isn't built-in, it can be added with a plugin or some custom coding. WordPress works just as well to manage websites that are more page-based than post-based, and it can be extended to do nearly anything.
-

CodeIgniter: Create a Blog in 20 Minutes
A twenty minute video showing how to use CodeIgniter to create a basic content management system with posts, permalinks, and comments.
-

Build a Login and Registration System with XML
Some smaller projects may not require a full-blown database for login credentials. This screencast shows how to create a login and registration system that stores data in XML files instead. The tutorial covers several interesting PHP things, including file manipulation and the SimpleXML functions.
-

A Crash-Course in WordPress Plugin Development
In this screencast, Jeffrey Way walks you through the creation of a basic WordPress plugin to automatically rewrite unfavorable HTML in posts. Covers plugin structure and the basis of the WordPress hook system.
WordPress
-

Using Custom Fields
The WordPress Write screen offers an option to assign metadata to a post when you are writing it. That data could be anything from a thumbnail URL to your current mood to a flag to enable/disable the display of part of the template. You can add and remove fields while editing a post, and later call the data programatically with the get_post_meta() function.
-

Creating Custom Write Panels in WordPress
Add a new meta box to the Write Post screen in WordPress. The tutorial uses post thumbnails as an example. The end result is a handy thumbnail URL field that creates a custom field to store the URL, allowing the theme to pull the image up with the post. If you make extensive use of custom fields, creating a meta box with a friendlier interface just might save you time in the long run.
-

10 Useful RSS-Tricks and Hacks For WordPress
Exclude categories from your RSS feed, put ads in your feeds, set a delay between when the post is published and when it shows up in the feed. Smashing Magazine gives ten hacks and tips for getting the most out of your WordPress site's feeds.
-

WordPress 2.7 Featuring Your Favorite Actions
Using the favorite_actions filter, add (or remove) items to the favorite actions drop-down in the upper-right of the WordPress 2.7 backend. Any page in the Admin can be added to the menu. You could do this from your theme's functions.php file, or through a plugin.
-

Easily display your last Tweet
Who doesn't use Twitter these days? The "A-List" bloggers were the early adopters, but now the Twitter community is full of developers, designers, politicians, businesses, celebrities, etc.. Wouldn't it be neat if you could put your latest "tweet" in your blog's sidebar? You could use a plugin, of course, but isn't it more fun to roll your own solution with a bit of PHP magic? Joost de Valk has some working examples to learn from.
-

Mastering WordPress Shortcodes
Shortcodes, introduced in WordPress 2.5, allow you to include things in posts with a simple statement such as [AdSense]. The placeholder is replaced with something useful whenever the post is displayed. To continue with the AdSense example, you could have any instance of [AdSense] replaced with your AdSense code.
-

How to Write a Wordpress Plugin
Writing a plugin is one of the best ways to contribute to the best ways to contribute to the WordPress community. If you have an idea for something to improve WordPress, put your PHP skills to use and make it happen. Devlounge has a comprehensive introduction to plugin development, which covers the major bases and should get you started in no time.
Books
-

PHP 5 for Dummies by Janet Valade
A solid and easy to understand introduction to the PHP language. True to the series' reputation, this volume could potentially teach nearly anybody (even someone without prior programming experience) how to write PHP scripts. A very good primer on PHP, though the current edition has a few errors from the typesetting process, namely the substitution of underscores where double-quotes should be.
-

PHP Hacks by Jack Herrington
O'Reilly Media is famous for the tech-centric books they exclusively publish. They consistently produce quality guides to everything from Linux to JavaScript to iPods. PHP Hacks is no exception. This book, rather than being a ground-up intro, focuses on practical lessons in PHP. The book is full of "hacks," short tutorials filled with code snippets that show you how to do interesting and useful things with the language. A great book for intermediate-level PHP coders.
-

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems by William Steinmetz and Brian Ward
From the venerable No Starch Press comes this gem, a 200-odd paged paperback chock-full of useful script bits to help you solve the tricky problems that come up all to often. Whether you're a PHP newbie or an experienced code-forger, there's something for you in this book. Keep a pad of paper handy when you read it.
-

The PHP Anthology: 101 Essential Tips, Tricks & Hacks by SitePoint
Inside The PHP Anthology, you will find not an introduction to PHP, but a more intermediate guide. It focuses on the Object Oriented approach throughout, and tries to give you a solid understanding of important and practical concepts that beginner books leave out, such as producing error-free output, XML web services, and the many aspects of security. It is full of useful tips and code snippets as well. Definitely worth a read.
Bonus: Some Useful PHP Functions
- Strtotime()
- Explode()
- Print_r()
- Serialize()
- Str_replace()
- Strip_tags()
- Rawurlencode()
- Htmlentities()
- Follow us on Twitter, or subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.
Related Posts
Check out some more great tutorials and articles that you might like
Plus Members
Source Files, Bonus Tutorials and
More for $9 a month for all TUTS+
sites in one subscription.










User Comments
( ADD YOURS )Bart May 27th
Thank you, these tuts will be very helpfull!
( )Shuuun May 27th
We love PHP
I will check some of this links !
If someone know an advanced HOW TO BUILD A CMS tutorial step by step, please write me an email, ty guys !
And keep on good php-code
( )oliver May 27th
you need to have lots of xp before trying to build your own cms. check how other open source cms built their systems see the pros and cons of the structure and you also need to have an indept knowledge on database relationships.
( )RocDaMike May 27th
Thanks Matt for this great list!
However, the URL for “How to Dynamically Create Thumbnails” incorrectly points to the PHP contact form tutorial from Kirupa.com . Thought you may want to check it out.
Otherwise, great job
( )Alex May 27th
This URL is coded wrong and the one to zebra striping, which points to the markdown one.
( )kevin May 27th
@Matt, “Zebra Stripes” link is also wrong. Could you please fix it?
Great list. Thanks.
( )redwall_hp May 27th
Thanks for pointing that out. You’d have to talk to Jeff Way, the editor, I believe. I don’t have access to edit the mistakes. The thumbnail one seems to be fixed. I think this is the link to the zebra striping post I had intended to reference:
http://www.nullislove.com/2007/05/09/zebra-striping/
( )Emanuele Ricci May 27th
In the Frameworks section maybe you can add Yii that it’s a new PHP Framework
I’m working with it and it’s very powerful
Site: http://www.yiiframework.com
( )Information: Yii — a high-performance component-based PHP framework best for developing large-scale Web applications. Yii comes with a full stack of features, including MVC, DAO/ActiveRecord, I18N/L10N, caching, jQuery-based AJAX support, authentication and role-based access control, scaffolding, input validation, widgets, events, theming, Web services, and so on. Written in strict OOP, Yii is easy to use and is extremely flexible and extensible.
Performance: http://www.yiiframework.com/performance/
Patrick May 27th
FAST?!
Hm, in comparison with other frameworks – maybe yes. My own framework takes >200 requests per second WITHOUT any caching technologies oder accelerators. And i can’t test it on a large server, i’ve tested it local on my windows 7 machine. Okay, it’s not finished yet, but it will be finished and optimized in summer i think. 150 Requests should be possible.
That’s why i don’t use such frameworks – they’re mostly inefficiant.
( )redwall_hp May 27th
My opinion on frameworks is that they make a lot of things easier once you familiarize yourself with one, but if you want the absolute best performance, you’re better off writing your own system.
mupet May 27th
Great list, great resources, but i cant found more tutorial about cakephp
( )Zoran May 28th
Your ansver:
phpvideotutorials.com
( )Andrea May 27th
Great readings, but I hoped to find something about OpenID and PHP.
( )A “simple” tutorial from you guys would be great.
insic May 27th
nice roundup. good for future reference.
( )luke May 30th
nice girl..nice roundup..
( )Alex | Blogussion.com May 27th
What a great post! I have it bookmarked for later reference. I have recently been starting to learn a little PHP, so I’m sure there is some great information here.
( )Jonas De Smet May 27th
I miss the Kohana link: http://kohanaphp.com in the list of frameworks. It’s based on CodeIgniter but only for PHP5
It’s my favorite framework!
( )Gav May 27th
I like the look of Kohana but find the documentation lacking, you have any good resources for the framework?
( )josh June 29th
Docs are lacking a bit, but the ones that are up there will help to at least get started with Kohana – especially if you already have experience with MVC – and especially Code Igniter – which Kohana was originally a fork of. All in all, Kohana is a great framework…
redwall_hp May 27th
I wasn’t aware of Kohana. It certainly looks interesting though.
( )B A B U May 27th
Nice collection. Keep it up.
( )Tanx
phpworker May 27th
Wow, quite interesting. I will stay for a day
( )lossy May 27th
eval is never the solution, dixit one of the creator of php.
( )Jônatan Fróes May 27th
We love PHP[2]
( )luglio7 May 27th
wwwow
( )mefisto May 27th
The article is OK, but what’s up with all that ‘wordpress fetish’ ?
( )redwall_hp May 27th
I’m a plugin developer, what do you want…
( )craw May 27th
yeaaaaaaaaaa wuhooo php
( )nice collection
wayno007 May 27th
Awesome roundup. You guys rock!
( )Jamie Rumbelow May 27th
Nice work!
I’m launching my new site next week, and it’s perfect for a list like this. It’s a site that sells cheap, high-quality screencasts on a variety of subjects, but primarily PHP. We’re launching 1st June with two screencast, one, Test-driven Development in PHP and one the first part of a series of screencasts on Mastering CodeIgniter.
You can sign up to the list now and we’ll send you an email when we launch. Who knows, there might even be some surprises
. Get there now at http://binarycake.com
Jamie
( )oliver May 27th
you forgot to add w3schools its the best php for dummies site i have ever known.
( )redwall_hp May 27th
It is a pretty good site. Their forum is also a great place to ask for help if you get stuck with something. I’ve recently noticed that they have an impressive PHP function reference that is starting to rank nearly as well as php.net for some search results.
I hadn’t though to put that many introductory resources in the roundup though.
( )Martyn Web May 27th
I have been wanting to learn more about php and begin to use it alot more as I want to start building my own wordpress themes rather than modifiying them and also begin to devle deeper into magento as well.
I know on themeforest there is a good set of screencasts for beginers, I just have to find some more time.
Good resource for future reference and I will be booking this post.
( )ricochet May 27th
Another tutorial on Magento would be great!
What do you think Matt / Jeffery?
Another good book is… PHP Solutions – David Powers
( )Michael Wales May 27th
The short echo tag iis not primarily used by CodeIgniter developers within their views. It is primarily used by lazy PHP developers – nothing to do with CodeIgniter at all.
In fact, the CodeIgniter Style Guide (derived from the Expression Engine style guide) explicitly states that PHP’s short tags are not to be used – long tags only.
This is not only due to the security issues mentioned within the article but to ensure portability of code between servers (where php.ini settings may differ).
( )Rafael R.P (Raff) May 27th
Thx, i love code igniter
( )Ramūns Usovs May 27th
Great list, some of it is even useful for seasoned php developers to take a look at some technologies that might have been missed
( )Myfacefriends May 27th
awesome very nice!
( )Tutorial City May 27th
You forgot to mention PHP With MySQL Essential Training/Beyond the Basics from Lynda.com.
( )Kevin Quillen May 27th
I’m not a lazy developer because I use php short tags. I also know how to configure a server.. so if php.ini needs configuring, I am going to do it.
( )Gav May 27th
I agree with kev on this one too!
( )Drew Douglass May 27th
I think the main argument for not using short tags is portability. What if your code needs to be used on a different server that doesn’t have short tags enabled? Sure, they could mess around with their settings but in my view it is an unnecessary hassle that is easily prevented.
( )ThE_OwNeR May 27th
I would love to see a tutorial about creating a advance CMS
( )Thad May 27th
PHP is such a powerful tool. For any budding designers it is a must learn. Thanks nettuts.
( )prock May 27th
nice list would you mind doing one for javascript please
( )Matthijn Dijkstra May 27th
‘Some usefull php functions’
What is ‘eval’ doing over there? Eval is evil most of the time, unless you have a verry good reason, it is a bad practise and bad design of your web application most of the time.
( )Muhammad Adnan May 27th
great list ..
( )stealth01 May 27th
Zebra stripes link is pointing to a wrong address.
( )Meshach May 27th
Great stuff, this will help me a lot.
( )Izulcybercafe May 27th
Wow, very nice Matt….
Terima Kasih… (Red:Thank you)
( )saurabh shah May 27th
nice roundup… thnx 4 sharing
( )Franky May 27th
Perfect this is great. Thanks
( )Scott May 27th
Awesome collection. This is perfect for my goal this summer to learn PHP.
( )Diego SA May 27th
Cool!
( )Cody May 27th
Thanks for all the great resources!
( )Tech-Notes May 27th
what an awesome collection !
thx … keep up the great work
( )Andi May 27th
Great collection! thx for this one
( )Lowkase May 27th
Great tutorial on how to compile a list of resources!
( )Miguel Hernandez May 27th
Thx for the awesome roundup!
( )46Bit May 27th
I’d suggest pointing out plain urlencode() instead/as well as of rawurlencode(), it’s often more suitable.
( )Marc Falk May 27th
Thanks man, nice collection of very useful tutorials there!
( )desu May 27th
Wow… thanks a lot. It help me to list anything about PHP (my favorite language)
( )Scott Vadovic May 27th
Been wanting to learn more about PHP lately, bookmarked for future reference, thanks a lot
( )IT Mentality May 27th
… and with all that knowledgeb going around and I still forget how to “print to screen”
( )jigish thakar May 28th
amazing information thanks, thanks alot
( )Ben Swift May 28th
As a designer, the PHP for Beginners tutorial kinda suited me perfectly. Then I read down, and ZOMG there’s a CodeIgniter tutorial for beginners!!
Ta.
( )Srky May 28th
Thank You for lot great information, I have few questions.
1) Should I learn whole php or just learn how to use on or two php frameworks?
2) What is best php IDE, and what is best free php editor?
3) Is better Kohana, Codeigniter or Zend and why?
( )Redwall_hp May 28th
You should learn straight PHP first. Frameworks will only confuse and limit you if you don’t have a solid understanding of the language first.
( )sandrews_06 May 28th
Personally I like Zend, but I hear Codeigniter is the easiest for people who haven’t used frameworks before. But I agree with redwall_hp you should learn straight php first.
( )Brad May 28th
I read the article ‘Password Hashing” above from the PHP Security Consortium and I would like to add one thought to it.
When hashing, I always use the exact time someone registered or logged in as a salt. IE: “2009-02-25 10:01:19″. This hash is almost impossible to predict or decode. I think it works as well as a random string.
Thanks for the incredible amount of information posted above. A service well provided
( )bebopdesigner May 29th
This is handy. cheers
( )kentut May 29th
Zebra Stripes link is broken. It is the same link as Markdown. Can you please fix?
( )Thanks
Philips Tel May 29th
wow…bravo!!!
i’ve visit all that above tutorials, and they are really very very good for web development.
thank you nettuts, i’ll never forget you, i’ll visit you every i have time to improve my skill programming….
thk….
( )Raymond Irving May 31st
It’s indeed a very nice list of php resources and tutorials.
I really like the idea of adding Zebra Stripes to tables so I have developed a very easy way to do this:
$page['table tr:even']->css(’background:#eee’);
See the full example here: http://raxanpdi.com/code-snippets.html#zebra-strips
( )ben June 3rd
Thought I might find a Tut about adding a ‘Search’ box to my site but maybe not ):
( )imehesz June 15th
here is another MVC framework – http://www.yiiframework.com/
( )Waseem June 28th
wow , this is an amazing post , I will learn this language from here .
( )Thanks a lot
DeJaaaN June 29th
great collection
( )Satya Prakash August 30th
Here is also a good posts to read for web scripting – http://bit.ly/GtydZ
( )Hari K T October 7th
Great post
( )Seven Version October 14th
Thanks for this helpful resource….. you are awesome..
You will find more help here….
http://blog.svnlabs.com/
Seven Version
( )