PHP Snippets

Alternating Background Color

Alternating background color. This would be useful if you have large text into a table so it can easily be read.

Date Format

Different date format you could use.

Email Spam Protection

This will protect you from spam when displaying your email address on your website.

Encrypt Password

Uses PHP's md5() function to encrypt password.

explode and implode example

Example of php's explode and implode function.

Footer Display

This simple snippet could be display below your website.

Length Limit

Check to see if a string reach a certain limit. Useful to avoid flood or other abuse.

mail Function Example

Here's an easy example of mail() function.

MySQL Connect

Here's an easy example of MySQL database connection.

MySQL Match

This will check your MySQL database for possible match, useful if you dont want two or more of same value on your database like an email address.

MySQL Random Rows

This will display a random row from specific MySQL database and table.

MySQL Stats

Display some useful information about your MySQL, databases and tables.

Random Image

Display random image from specific directory.

Replace Smiley

This function will replace smiley text (":)",":D", etc...) with your smiley image.

Search Google

This will search google with the specified keyword.