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...
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...
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...
Here is a small PHP snippet to easily create a table in PHP. First create the draw_table function.
As of August 2013 Google shut down it's weather API. The following tutorial will not work with the Google weather API but you can use the following code for another weather API that you find. ![Wea...
Stumbleupon is a great way of getting lots of visitors to your site. All you have to do is submit your pages to Stumbleupon and when people stumble in their chosen topic they will find your page. The...
In a previous article you learnt how you can display the the author avatar in Wordpress. But if you aren't using Wordpress then you will need to use a Gravatar. ## Gravatar A Gravatar is your image t...
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...
Here is a quick PHP snippet that you can use to tell if the request coming to the page is from a form or from an Ajax request. Where a page is being accessed by AJAX it will post data using XML, PHP c...
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...
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 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...
During OOP in PHP you need to debug the class, you can use the var_dump method but this isn't so user friendly, so you need an alternative to the var_dump(); PHP have released some magic method which...
If you have a website which allows users to upload their own images then you will need to change the default maximum files size upload. The PHP default for all file uploads is 2MB, so the server will...
A static method allows us to use the method without creating the object first. This means that we can use the scope resolution operator :: to use the method. Static methods can not be accessed by usin...