Simple PHP Script to Send Email with Mail()

There are three requirements for sending email through a PHP script: A form, an email processing script, and PHP’s mail() function to be enabled (most hosts have this enabled, but some shared ho...

How to Create a PHP Redirect?

Sometimes you want to hide an affiliate link, sometimes you may want to log each downloads of a file or just redirect the user to a site through your script. This is where PHP redirection comes handy....

Download Remote File Using CURL and PHP

Sometimes you need to download URL’s contents using the CURL library, included inside PHP (e.g if you want to use a web-based API, provided by service like TinyURL, Digg, Twitter). It’s ac...

PHP Script to Show Visitor’s IP Address

Sometimes you want to get the visitor’s IP address (e.g to show it to him or for logging purposes). This simple snippet does the job: $ip = $_SERVER['REMOTE_ADDR']; Also, if you have REGISTER_GL...

Top Online IDEs to Test Your PHP Code

Sometimes you don’t have an Apache server on your PC and you don’t want to go through the hassle of uploading your PHP script to your web hosting space just to test if your tweaks inside t...

Convert Text to Barcode Image

Thanks to a skilled PHP programmer, the internet has a ready made PHP script that takes a text string and returns an image representation in barcode format. Here’s the complete script: =1 to ena...

How to kill PHP (on purpose)

1. Stack overflow (e.g calling a function inside itself). function a() { a(); } a(); First you define a function called a() and the function’s sole purpose is to call itself again, causing an in...

Easy PHP Debugging

Spotting errors inside PHP is a difficult task. Especially if you try to understand the default messages, given by the PHP interpreter. If you want to effectively debug your PHP script, you can use th...

Connect to a MySQL Database

This is the very basic step, needed to work with MySQL databases. Before trying to do any actions on the database itself, such as: creating tables, querying rows, dropping tables or else, you have to ...