Posts marked with "Function" in tags

E-Mail Verification Script In PHP Using Mailgun API

As years goes, so does the increase in SPAM on the web. Most users sign up on services with a fake E-Mail. They might even use other’s E-Mail for signing up. This is a big problem, because when you send an email to the signed up user, it goes to the wrong guy. So, you should verify user’s email before signing them up. You might think that it would cost database memory.... [READ MORE]

Image Handling On Client Side With Base64 In PHP

Every website needs images. It make the site attractive and beautiful. But sometimes, images won’t get loaded. The latest **Browsers **have a feature that generates image on a base64 string. Most of the browser have it. In this post I’m going to describe the way to use base64 in displaying images on a website. What’s base64 ? Base64 is a encrypting method which is available in many languages. It can be used for encrypting and decrypting.... [READ MORE]

Generating Random String in PHP

In PHP you can generate random number by using rand function, but there is no specific function to generate a random text or string. In this post I’m going to show the function that will generate a random string of length mentioned. Here is the function: function rand_string($length) { $str=""; $chars = "subinsblogabcdefghijklmanopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $size = strlen($chars); for($i = 0;$i < $length;$i++) { $str .= $chars[rand(0,$size-1)]; } return $str; } Usage To generate a random string use rand_string() function with the parameter of length of the to be generated string.... [READ MORE]

Add GET or POST parameters on include files in PHP

If you want to add GET parameters or POST parameters to files loading using include function in PHP then you should know the following: It’s not possible. But it is in a different way. If you are adding GET parameters to file name like the following, then it won’t work: The above code won’t load the file, because PHP Include function only looks for files, it won’t send any parameters.... [READ MORE]

How to get Current Time and date in Javascript

This tutorial will help you to get current date and time at which the function is executed. Here is the function: function ctime(){ var currentdate = new Date(); var time=currentdate.getFullYear()+"-"+(currentdate.getMonth()+1)+"-"+currentdate.getDate()+" "+currentdate.getHours()+":"+currentdate.getMinutes()+":"+currentdate.getSeconds(); return time; } Just print out ctime() function to get the date and time in the format YEAR/MONTH/DAY HOUR:MINUTE:SECOND  Explanation : new Date() function prints out the current date and time in a disorderly way. You can order it in any way as I did in the time() function.... [READ MORE]

The best age calculation code in PHP

Age calculation is a tricky calculation especially in Programming Languages. I’m going to tell you a simple way to find out age in PHP. This is a simple function that will calculate age if it is given a birthday date in the format date/month/year. For example : 20/01/2000 or 04/12/1990 Here is the function : function age($birthday){  list($day,$month,$year) = explode("/",$birthday);  $year_diff  = date("Y") – $year;  $month_diff = date("m") – $month;  $day_diff   = date("... [READ MORE]



Mastodon  Twitter

GitHub GitLab


Demos  Lab


This blog was once on WordPress. Now a static site. See source code on