background preloader

Ten PHP Best Practices Tips that will get you a job

Ten PHP Best Practices Tips that will get you a job
Posted by blake on Jun 4, 2008 in Code, Performance, PHP | 167 comments The last couple of weeks have been quite the experience for me. I was part of a big layoff at my former company, which was interesting. I've never been in that position before, and it's hard not to take it personally. I started watching the job boards, and a nice-looking full-time PHP position caught my eye, so I sent out a resume and landed an interview. Find the errors in the following code: So, give it a shot. If you got the missing comma in the parameter list, the "new Array()" error, the colon instead of a semi-colon, the '=' instead of '=>' in the foreach statement, and the erroneous use of '+' on the echo line, then congratulations, you found all the errors! That's not how I answered the question though. After pointing out the actual errors, I made a point of adding comments about those things I just mentioned. So, read on for my Ten PHP Best Practices Tips that will get you a job: 1. 2. 3. 4. 5. 6. 7. 8. 9.

7 Secure, Lightweight, and Easy to Use PHP Frameworks Choosing a good PHP frameworks can help you develop complex Rich Internet Applications quickly, with a best practices oriented approach, and saving a lot of time reusing code snippets that are already available. There are a lot of interesting PHP frameworks you can choose for your next web project. Which framework you choose is really a personal decision. There is no one “best” framework on the market at the moment. Different frameworks are better for different types of projects, and for different developer. Today we will focus on 7 secure, lightweight and easy to use PHP Frameworks. Why Use a PHP Framework? There are plenty of reasons to use a PHP Framework to build your websites. 1. Below we’ve covered some of the best frameworks available today. 1. CodeIgniter is a powerful, high-performance, open-source PHP framework that helps you author PHP applications rapidly. CodeIgniter has an exciting online manual, a couple of helpful video tutorials and an active user forum. 2. 3. 4. 5. 6. 7.

Good PHP Tutorials - Beginner To Advanced PHP Programming Tutorials Tutorials Zend Server Web API spotlight: Connecting to a Zend Server cluster part 2 Hey everybody, In a previous post I introduced the serverAddToCluster Web API action which allows us to initiate clusters and join existing ones with Zend Server. That post showed some code and discussed how the clustering process is started; now I will talk about how we should track the progress of our cluster and deal with […] Continue reading... PHP 101: PHP For the Absolute Beginner p. Continue reading... XML- RPC Client This tutorial teaches you, step-by-step, how to build an XML-RPC client in PHP using the XML-RPC library written by Edd Dumbill. A primer is included to introduce the basics of the XML-RPC specification. Continue reading... VIDEO : Behavior Driven Development with Behat Behavior Driven Development with Behat Unit tests give you a good base to ensure your classes are working technically correct. Continue reading... Installing and Configuring Zend Server 6 on Apple Mac OSX Continue reading...

30 game scripts you can write in PHP, Part 1: Creating 10 fundamental scripts Getting started As both a game master/storyteller and a developer, I frequently find myself writing little utilities and scripts to help me when running, planning, and playing games. Sometimes I need a quick idea. This article will explore 10 fundamental scripts that can be used in various types of games. We will blaze through these scripts pretty quickly. Back to top A basic die roller Many games and game systems need dice. In many cases, that would be more or less fine. Listing 1. function roll () { return mt_rand(1,6); } echo roll(); Then we can pass the type of die we want to roll as a parameter to the function. Listing 2. function roll ($sides) { return mt_rand(1,$sides); } echo roll(6); // roll a six-sided die echo roll(10); // roll a ten-sided die echo roll(20); // roll a twenty-sided die From here, we can go on to rolling multiple die at once, returning an array of results, or rolling multiple die of different kinds all at once, depending on our needs. Random name generator Mad Libber

Improve website load time by 500% with 3 lines of code | Aciddrop.com Major New Update - PHP SPEEDY: latest version available here There are 4 relatively easy ways by which you can speed up the time it takes a browser to download a page: Make fewer HTTP requestsAdd a far-future expires headerGzip your page's componentsMinify your JavaScript, CSS and HTML Following on from my post on joining CSS and JavaScript files, I have written a PHP script which will automatically do all of the above. The code require_once('class.compressor.php'); //Include the class. And the following at the bottom of the page: The Demo That's it! The class can be downloaded here: site speed boost class download Requirements A server running at least PHP4. Setting basic options Options can be set with a comma separated string as follows: $compressor = new compressor('css,javascript,page'); The string can contain 'css', 'javascript' and 'page' depending on which elements you would like to be compressed. Setting advanced options Note that "cachedir" should not include a trailing slash. Download

15 Best Resources To Learn PHP Online PHP is the scripting language can be embedded into HTML , used for develop web applications. Every type of websites can create with the help of this language. This language can run almost on every operating system and platform. Java, .Net, Perl and many more are language used for creating websites with its different and useful functionality. PHP language have some popular features and functionality which makes it popularity among developers. Online tutorials always being popular among internet users. their are number of websites to help providing designs and development tutorials which help to learn different everytime. Today we have listed 15 best website to learn PHP online. 1) PHP.net 2) PHP Builder 3) Deniweb Forum 4) W3Schools 5) Stack Overflow 6) PHP Edit 7) PHP Designer 8 ) Zend Studio 9) WikiBook’s PHP Books 10) PHP Tutorials 11) Developer Tutorials 12) 9Lessons 13) Hot Scripts 14) PHP Freaks 15) Big Resouces

PHP include() and require() OBJECT ORIENTED PHP TUTORIAL FOR BEGINNERS Preamble The hardest thing to learn (and teach btw,) in object oriented PHP is the basics. But once you understand them, the rest will come much, much easier. But don’t be discouraged! You just found the easiest to understand tutorial out there on OOP and PHP. … Or so I’ve been told. About This Tutorial This tutorial is designed to teach total beginners object oriented PHP. This is not a long-winded theoretical blathering that you see all too often; instead, we actually start writing OO code very quickly. So before you begin, get out your favorite PHP code editor and be ready to write and run some object oriented PHP code. PS: scroll to the bottom of the page for the supporting videos. Thanks for reading, Stefan Mischook Introduction With the release of php5 in 2004, php programmers finally had the power to code with the ‘big boys’. In this tutorial, you will be guided (step-by-step) through the process of building and working with objects using php’s built-in OOP capabilities. OOP Videos

PHP encryption for the common man Consider how today's world differs from the world of just 20 years ago. Long ago, in the 1980s, encryption was spy stuff -- something you read about in a techno-thriller by Tom Clancy. If somebody wanted to keep a bit of information private, he encrypted the data with a password, a pass phrase, or another basic method. Fast-forward to today and encryption is everywhere. As a PHP developer, you should be aware that strong security practices aren't just for exotic applications -- they're for the project you're working on now. There's not enough time or room to discuss every aspect of encryption here, but you'll learn the essentials that will cover most situations you'll find yourself in. Cryptography primer Cryptography is the art of "secret writing," as the word's Greek roots attest. Plaintext: Veni Vidi ViciCiphertext: Xgpk Xkfk Xkek By examining the ciphertext, you can use a few heuristic tricks to figure out the plaintext has been shifted two characters. Listing 1. Listing 2. Summary

Related: