Your First PHP Script - Hello World!

2 minute read

In this series of tutorials, I’ll give you a little introduction to the PHP programming language, which is used to dynamically generating web pages. If you f...

How to find the current URL in PHP

1 minute read

The full URL to a page comes in three parts: The domain name, the path to the file then the filename, and the query string. For example, take the URL http://...

Find a visitor’s IP address with PHP

1 minute read

Do you want to know the IP address of a visitor? This can be useful for many reasons, such as tracking site usage or blocking access to specific people. Here...

Rotating Images with PHP

4 minute read

This tutorial will show you how to rotate an image in your PHP scripts. You’ll need to have the GD library installed to be able to use some of the functions ...

How to Generate Random Numbers in PHP

1 minute read

To create random numbers in PHP, you can use the rand() function call, which takes either zero or, optionally, two parameters determining the minimum and max...

How To Read a File’s Contents in PHP

3 minute read

PHP provides three built-in functions which allow you to easily read the contents of a file on your webserver. This is useful when, for example, another prog...

How To Find Items in PHP Arrays

1 minute read

The problem: we have an array of items in PHP and we want to find out if a specific item is in the array. In code we can define the array as: