PHP function to get difference between dates

Jul 15, 2023

Below is a PHP function that calculates and displays the difference in days between two dates. This function will take two date strings as inputs, convert them to DateTime...

Get Current Page URL Without Query Parameters in PHP

Jul 14, 2023

When you work with websites using PHP, sometimes you need the clean page URL without extra parameters. For example, your URL may look like this: But in many real cases, you only...

Clean WordPress database infected with Malware

Jun 3, 2023

I just finished a new job to clean a WordPress website that was compromised with malicious codes. Removing the malicious codes from the theme files is easy, but the complex...

Delete users from WordPress database

May 30, 2023

I just finished a new job to clean a WordPress website that was compromised with malicious codes. While investigating I noticed that there were several unidentified admin users created on...

Generate random number in PHP

Mar 31, 2023

In PHP, you can generate a random number between 1 and 9 using the rand() or mt_rand() functions. Here are examples of both: Using rand() Function: **$randomNumber = rand(1, 9); echo...

Convert Indian currency from numeric to words in PHP

Sep 30, 2022

To convert a numeric value to Indian currency format (words), you can use a custom function. Here’s an example of how you can achieve this: This function **convertToIndianCurrencyWords()** converts a numeric...