How To Compare Strings In PHP

During any sort of programming you will always get situations where you need to compare values with each other, if the values are boolean or integers then the comparison is simple. But if you want to...

Formatted Strings With PHP

When you are using PHP to putput a string on the page most of the time you will use the syntax echo, which will take the following string and display that string in HTML. You can even concaternate mul...

Encode Email Addresses With PHP

Spam bots will crawl your pages exactly the same way Search Engines crawls your pages, but while Search Engines are crawling to index your content, spam bots are crawling to find certain information....

Namespaces With PHP

PHP namespaces was introduced in version 5.3. Namespaces is a way of group classes together into virtual directories, the main reason we would want to do this is to help avoid collision of class names...

Difference Between PHP Include And Require

One of the most common questions I get asked by PHP beginners is, Why is there 4 ways to include a file on your page? There is include(), include_once(), require() and require_once(). What do these do...

Disable HTTP Cache With PHP

HTTP Caching can be an important feature for websites it will allow your browser to cache your web elements that your page will collect via HTTP. When HTTP caching is turned on your web pages will loa...

How To Use PHP To Get Visitors Browser

With the raise of popularity in using mobile devices to access websites, web designers need to start designing their websites so it can be used correctly on a mobile device. There are several ways you...

Get The File Extension In PHP

Getting a file extensions from a PHP string is an important task on validating a file for a upload. For example if you have a file uploader which you only want to use for image uploads then you need...

Parse URL Querystring Into Array In PHP

Using query strings in PHP is a good way of transferring data from one file to another. This is done by using the $_GET variable. This variable is a global variable that is used to get the content of...

Get Current URL With PHP

Use the below PHP snippet to construct the current page URL. It will find out if the URL is on a secure URL or not, gets the server name and port number if needed and the current page. function...

Easily Create A Table In PHP

Here is a small PHP snippet to easily create a table in PHP. First create the draw_table function.

How To Create A URL Slug With PHP

Having a user friendly URL is user important not just for SEO but also to help the visitors know that the website they are on is correct. If you have spaces in your URL they will be replaced by %20 s...

How To 301 Redirect With PHP

Search engines index pages by the URL of the page, if these pages are moved to a different URL then the search engines will have indexed a page that no longer exists. Therefore people search in the s...

Use PHP To Get The Real IP Address

If you want to record the visitors IP Address there are a few things you need to remember, computers on shared internet connections can have different IP Addresses and visitors coming to your website...

PHP __get And __set Magic Methods

PHP is a loosely typed programming language, one of the features of a loosely typed language is that you can use variables without declaring them or their type. In other languages such as c# you need...