PHP Web Development Tutorials

PHP Web Development Tutorials and Articles
  Title / Author Reverse Sort Order Replies
Say if you want to generate graph on your website using data from a data base, you might be wondering how to go about it. Well the best way I would do it is use free PHP GD library. Here is a class i wrote to generate a graph in a PNG image for me. class BarGraph { var $barWidth; var...
I never recommend using " (double quotes) when programming with PHP. Always use ' (single quotes) unless you need the features of " (double quotes). You might think it's much easier to write code as: echo "Today is the $day of $month"; However, using single quotes forces variables to be...
PHP will automatically convert data types as necessary across the board - you need not worry about it happening. If you specifically wish to override PHP's type conversion, you can perform what is called a type cast - you forcibly convert a variable of type A to type B. In PHP, type casting looks...
Sometimes we need to find the number of items, located inside an array.Let's take this array as example, $a=1; $a=3; $a=4; $a=5; here the total item count is 4, but when you use count() function you get 3. So I wrote a small function which counts array elements, even recursively. ...
If you have PHP4 working on your server, and have heard that PHP5 may screw up things. Here's how to have both running alongside. #!/bin/sh # PHP5 CGI Installer for cPanel/WHM Servers VERSION=5.0.4 cd /usr/src wget -O php.tbz2...
Morse code is a method for transmitting information, using standardized sequences of short and long elements, for the letters, numerals, punctuation and special characters of a message. The short and long elements can be formed by sounds, marks or pulses, and are commonly known as "dots" and...
PHP is arguably the most popular scripting language for Web sites. This popularity comes with a price, however, and that is increased attention to various vulnerabilities in PHP itself and in the plethora of Web applications written in PHP. The security features built into PHP are weak, and the...
I was wondering in how many ways can we iterate through an array in PHP. So, I figured out a few, here's it... Our Array, which we will be iterating on, $arr = array('PHP','Perl', 'JavaScript','AJAX', 'Python','ASP', 'C#'); 1. Using a simple for loop // using for loop ...
Recently, an obscure detail in the way PHP processes strings came to my attention. This is processed by code that checks for simple lists (like 1. blah 2. blah, or - blah - blah, etc.). However, an innocent call to in_array($x, array('1.', '0.')) had surprising and unexpected results: our...
Introduction XOR encryption is a trivially simple symmetric cipher which is used in many applications where security is not a defined requirement.Exclusive-OR encryption, while not a public-key system such as RSA, is almost unbreakable through brute force methods. It is susceptible to...
Introduction ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple Caesar cipher used in online forums as a means of hiding spoilers, punchlines, puzzle solutions, and offensive materials from the casual glance. ROT13 has been described as the "Usenet equivalent of a...
Introduction The RGB color model is an additive model in which red, green, and blue (often used in additive light models) are combined in various ways to reproduce other colors. The name of the model and the abbreviation ‘RGB’ come from the three primary colors, red, green, and blue and the...
While working with currency calculations, we often require to round a number to the nearest 10 or the nearest 50, like 407 should be 410. I've written a function which will do exactly that, it requires two parameters the number to the round, and the integer to be rounded to. The function is like...
The below is a code to gauge ur php performance <?php function micro_time_val($mytime) { $gettime=explode(" ",$mytime); $msec=(double)$gettime; $sec=(double)$gettime; return ($sec + $msec);
Background I've needed the header function in php so many times I figured I'd write a tutorial on it. This tutorial should help you do most of the things that the header function is capable of. Simply put, the php header function will send a http header to the browser. Headers in PHP If...
Management of files Manipulating files is a basic necessity for programmers and PHP gives you a great deal of tools for creating, uploading, and editing files. When you are manipulating files you must be very careful because you can do a lot of damage if you do some errors. Common errors include...
File upload is very common requirement of many web sites. We may require to upload pictures online to websites. Image upload is very common requirement and many sites are using this to allow members or visitors to upload files. We will learn how to upload multiple files using a single form. This...
All like to create PHP scripts as fast as possible, and we try to take any shortcuts that we have. Here are few tips to speed up php code Tip -1 Using a good editor can really save you time. If you're still stuck on using Notepad to edit your PHP scripts, switch right now. There are...
Arrays are common to many programming languages. They are special variables which can hold more than one value, each stored in its own numbered 'space' in the array. Instead of having many similar variables, you can store the data as elements in an array.Each element in the array has its own ID so...
A trend with a lot of new Web Designers is to blindly go for ASP or JSP for creating dynamic and interactive websites. Why use PHP for server-side scripting? This question comes in mind of a lot of Web Designers, especially in mind of designers/programmers who are only exposed to much hyped server...