Get Percentage Function PHP

Sometimes we need to calculate the percentage of certain value in our project. In that circumstances you can use following PHP snippet to do that task.echo get_percentage(10, 100); //usage function get_percentage($percentage, $of) { //courtesy : $percent = $percentage / $of; return number_format( $percent * 100, 2 ) . '%';; }

Block Disposable email domains from signing-up (PHP)

It is really annoying to know that half of your users’ emails getting bounced because these sneaky users used some disposable email address to register on your site. Yes, it happens a lot, the only way to stop this from happening again is to block them from ever using those phony emails again.

Get only domain name from email using PHP

Sometimes you need to extract domain name from email using PHP for whatever reason, in that case you can use code below :$email = "[email protected]"; $domain_name = substr(strrchr($email, "@"), 1); echo "Domain name is :" . $domain_name;

Create New Widget in WordPress

Sometimes we need to create a widget in WordPress Template, to create a new widget just drop this line in your theme function.php file, and make changes as required.