Remove Characters At Start And End Of A String In PHP

In a previous article about how you can remove whitesapce from a string I spoke about using the functions ltrim() and rtrim(). These work by passing in a string and they will remove the whitespace. Us...

Store HTML View File In A Variable

If you have used a MVC language before you would be familiar with the practice of separating your business logic from your HTML. The way this works in MVC language is that the framework will allow you...

Hash Passwords With PHP 5.5

Almost every PHP developer would have to build an application that relies on a user login. This will involve the user of the website having a Username and Password which is stored in the database so t...

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...

Automatically Detect Browser Language With PHP

When you are working on a multi national website you may need the functionality to translate your website into different languages. There are many ways you can translate a website, in this article I w...

Resize Image Class With PHP

A common feature that you will across in websites is the ability to resize an image to fit an exact size so that it will displayed correctly on your design. If you have a very large image and you are...

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...

Dependency Injection With Test Driven Development

With unit tests you can check that your code behaviours just as you expect it to. When writing your unit tests you shouldn't need to worry about if any other area of the application is working correct...

Test Driven Development With PHP

In a previous post I wrote about the benefits of using Test Driven Development in your application development process. This can be used in all types of development from software to web to front-end t...

Test Driven Development

In this post we will be investigating what is test driven development and how we can use it to improve our development process. What Is Test Driven Development? Test driven development is a developmen...

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...