Saturday, July 4th, 2009

Archive for May, 2008

Validate numeric string

Check if a string is numeric or not.

Read more

E-Mail Address Validator

This function checks if an email address is valid or not. For example it is very useful if you have to validate a html form where someone should enter a real email address.

Read more

Get filename of the currently executing script

Using this piece of code you will get the filename of the currently executing script without containing the full path to it.
For instance if $_SERVER['PHP_SELF'] is equal with /public_html/web/login.php our code will return only login.php

$self = basename($_SERVER['PHP_SELF']);

Read more

How to remove empty values from an array

This function removes empty values from an array. This is useful if you

Read more

Redirect Visitor

This function will redirect the visitor to a specific location.
<?php
function go($location)
{
header("Location: ".$location);
exit;
}

// Location
$location = ‘http://www.google.com/’;

// Redirect the visitor
go($location);
?>

Read more