Oct 3
Creating a Tag Cloud
This is a short tutorial that will give you an idea of how to create a Tag Cloud and implemented it the pages of your website.
Oct 3
Display values from an array in random order
This is a function that randomizes the order of the elements in an array.
Oct 3
Cropping a rectangle image to square using GD
This is a PHP Class that crops images (rectangles) to squares using the GD library.
Oct 3
How to remove a (non-empty) directory
Here’s a snippet that can help you to remove a non-empty directory from the server. It’s a recursive function that deletes the directory with its files, folders and sub-folders.
Oct 3
How to resize an image (on the fly) and keep its aspect...
This is a PHP Class useful if you need to resize images keeping their aspect ratio, using the GD Library. The new height is calculated proportionally to the new width's size and reverse. For instance you have an image with the following dimensions: width - 1000, height - 800. Its thumbnail with a width of [...]
Oct 1
Using an autoload function to make your life easier
In PHP 5 you can make your life a lot easier by writing an autoload function. This function will automatically load your classes, so you do not need to repeatedly include classes on every page.
Sep 29
Loading Excel Data Using PHP
Some PHP applications (most often CMS backends) need to load Excel data directly from .xls file, manipulate and insert into a database. This tutorial shows one of the ways how to do it.
Sep 26
Shorten a string (text)
This is a function which shortens a text. For instance, this is useful when you want to display in a page excerpts from your articles (with the link to the full article).
Sep 26
Show random image(s) from a directory
This script is useful if you need to randomly select images from a directory.
Sep 26
How to convert smilies to graphics
This is a function that modifies a text (comment) by converting the emoticons like , , (Y) etc. to graphic icons.
Sep 25
Advanced IP Ban Script
This script is useful if you want to restrict the access to some people on your site, based on their IPs. There are 2 lists which can be used: one which has a list of the IPs you want to ban and one which you can use to ban a range of IPs. The script [...]
Sep 25
Submit a form without page refresh using JQuery & AJAX
The aim of this tutorial is to help you to create a simple (tableless) contact form using AJAX, JQuery & PHP. We will have a HTML page which will contain the form, a CSS file, a php page where the data will be sent and another file where the validation function(s) will be located.
Sep 6
Working with dates and times in PHP
When developing more complex PHP sites, especially forums, discussion boards and blogs where date and time functions are important, you’ll regularly encounter situations where you need to display and manipulate values based around the current date and time. PHP includes a range of functions which can help you to easily format and adjust your date [...]
Sep 6
PHP Image manipulation with GD2
One of the more surprising things you can learn about PHP is that it’s actually very useful when it comes to manipulating images of varying filetypes and formats. And a good thing too, since a lot of the internet is made up of pictures! The functionality of PHP in terms of image manipulation ranges from very [...]
Sep 6
Reporting and handling errors in PHP
When developing a PHP project, whether it’s a simple website or a much larger web application, it’s always a good idea to take into account the potential appearance of errors in your PHP code. An error occurs whenever PHP tries to execute an instruction which either results in an impossible outcome, or otherwise prevents the [...]