How do you disable viewport zooming on Mobile?

HTML Meta tag inside write user-scalable=no like below:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

How to calculate “time ago” in PHP

function time_ago($time)
$periods = array(“second”, “minute”, “hour”, “day”, “week”, “month”, “year”, “decade”);
$lengths = array(“60″,”60″,”24″,”7″,”4.35″,”12″,”10”);

$now = time();

$difference = $now – $time;
$tense = “ago”;

for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
$difference /= $lengths[$j];

$difference = round($difference);

if($difference != 1) {
$periods[$j].= “s”;
return “$difference $periods[$j] ago”;
$time = strtotime(your date);
echo time_ago($time);

1 minute ago

Sending files using cURL in PHP


$target_url = ‘ ‘;
$file_name_with_full_path = “C:/xampp/htdocs/demo/1.jpg”; //full path of your file

$ch = curl_init();
$args[‘files’] = new CURLFile($file_name_with_full_path);

curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);


[files] => Array
[name] => 1.jpg
[type] => application/octet-stream
[tmp_name] => C:\xampp\tmp\php4565.tmp
[error] => 0
[size] => 158530


Send email by using SMTP in PHP via localhost

Send email by using SMTP in PHP via localhost

* This example shows settings to use when sending via Google’s Gmail servers.
require ‘PHPMailerAutoload.php’;
//Create a new PHPMailer instance
$mail = new PHPMailer;

//Tell PHPMailer to use SMTP
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = ‘html’;
//Set the hostname of the mail server
$mail->Host = ‘’;
//Set the SMTP port number – 587 for authenticated TLS
$mail->Port = 587;
//Set the encryption system to use – ssl (deprecated) or tls
$mail->SMTPSecure = ‘tls’;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication – use full email address for gmail
$mail->Username = “”;
//Password to use for SMTP authentication
$mail->Password = “gmail password”;
//Set who the message is to be sent from
$mail->setFrom(‘’, ‘Example’);
//Set an alternative reply-to address
$mail->addReplyTo(‘’, ‘Example’);
//Set who the message is to be sent to
$mail->addAddress(‘’, ‘To name’);
//Set the subject line
$mail->Subject = ‘Your Subject’;
//Replace the plain text body with one created manually
$mail->Body = ‘Message Body Text’;
//Attach an image file
$mail->addAttachment(‘images path’);
//send the message, check for errors
if (!$mail->send()) {
echo “Mailer Error: ” . $mail->ErrorInfo;
} else {
echo “Message sent!”;


How to change the status bar color using meta tag

You can change the appearance of the default status bar to either black or black-translucent. With black-translucent, the status bar floats on top of the full screen content, rather than pushing it down. This gives the layout more height, but obstructs the top. Here’s the code required:

<meta name=”apple-mobile-web-app-status-bar-style” content=”black”>

How to change mobile theme color using meta tag

This below code write under your <head> tags.

<!– Chrome, Firefox OS and Opera –>
<meta name=”theme-color” content=”#4285f4″>
<!– Windows Phone –>
<meta name=”msapplication-navbutton-color” content=”#4285f4″>
<!– iOS Safari –>
<meta name=”apple-mobile-web-app-capable” content=”yes”>
<meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”>

How to add loading spinner image(page load images) in php using javascript

PHP Code:-


function preloader(){
document.getElementById(“loading”).style.display = “none”;
document.getElementById(“load_images”).style.display = “none”;
document.getElementById(“contents”).style.display = “block”;
window.onload = preloader;

#load_images{ background-color: #000000;
display: block;
height: 100%;
left: 0;
opacity: 0.6;
position: fixed;
top: 0;
width: 100%;
z-index: 9999;}
div#contents {
display: block;
#loading {
top: 50%;
left: 50%;
position: absolute;
cursor: wait;

<input type=”submit”>

Your Contain here……