8 useful PHP code snippets for developers

Today, i want to share you some useful PHP code snippets which may reduce your development time.

1.Send HTML Mail

<?php
$to = "info@yoursite.com";
$subject = "This is my test html email send using php mail function";
$body    = "Body of your message here you can use HTML too. <br /> <h1> Header </h1> ;";
$headers = "From: User \r\n";
$headers.= "Reply-To: info@yoursite.com\r\n";
$headers.= "Return-Path: info@yoursite.com\r\n";
$headers.= <"X-Mailer: PHP5\n";
$headers.= 'MIME-Version: 1.0'."\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
mail($to,$subject,$body,$headers);
?>

Read more