Here is how to find odd and even numbers in php.
Continue Reading »
PHP how to find Odd and Even numbers
PHP replace only first occurrence of a string match.
How to replace only the first occurrence of a string in php.
PHP Leading Zero for Double Digit Numbers
How to output a number with leading zero like dates and time.
Continue Reading »
PHP MySQL Order by Two Columns
Here’s how to order your data by two or more columns using PHP and MySQL Continue Reading »
PHP Validate Email Address, Phone & URL
Validate email using PHP grep functions
function isValidEmail($email){ return eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $email); }
Validate phone numbers
$phone = preg_replace('/[^0-9]/', '', $phone); # remove non-numbers // check if > 9 digits if (strlen($phone)>9) { echo 'Valid'; }
Validate URL links
if(preg_match("/^(http(s?)://|ftp://{1})((w+.){1,})w{2,}$/i", $url)){ #Is a valid URL } else { #Is not a valid URL }
Php Remove Non-Alphanumeric Characters
How to strip all symbols and numbers from a string of alphanumeric text. This php code will help you delete, remove, strip and erase any non-alphanumeric characters, and then return the data without the unwanted characters. Continue Reading »
Create MySQL Database With PHP
Create a dynamic web site by using MySQL Database and PHP. It is easy and I provided the code to cut and paste. Continue Reading »
PHP Lesson 3 – Creating Functions
How to create Functions in PHP and also how to Pass Variables to Functions.
Continue Reading »
Portion() function for trimming text
Returns the portion of text specified by the start and length parameters. This help to trim text down for display in a small area or to give a sample of a larger body of text.
Continue Reading »
PHP Order By Multiple Fields in MySQL
Want to be able to order by two or more database fields / columns using the ASC and DESC order clause
Continue Reading »


(58 votes, average: 4.69 out of 5)