Subtract time (hours, minutes, and seconds) from date can be easily done using date() and strtotime() function in PHP. You can use date() and strtotime() functions together to subtract hours or minutes or seconds form the current DateTime using PHP.

By: CodexWorld Sep 16, 2020

The preg_replace() function performs a search with the regular expression and replaces the matches with specified replacement. Use preg_replace() function to remove special characters from string in PHP. Removes the special characters from string except space with regular expression using PHP.

By: CodexWorld Sep 13, 2018

The string comparison can be easily done by the PHP built-in function called strpos(). The strpos() function in PHP, is the easiest way to check if a string contains a specific word or substring. Use strpos() function to check whether a specific word exists in the given string.

By: CodexWorld Aug 26, 2022

Human readable file size makes easier to read the file size and converts a number of bytes in the largest unit. To display file size in human readable format, you need to convert it to KB, MB, GB, TB, etc. Generally, the file size is stored in bytes which can be easily converted to kilobyte, megabyte, gigabyte, etc format.

By: CodexWorld Aug 28, 2018

The website availability status can be checked from the PHP script and notify about the downtime if the website is down. The cURL is the easiest option to check website availability with PHP. If you want to check the website’s server status, perform a cURL request to check if the website is available or online.

By: CodexWorld Aug 6, 2018

The array_map() and array_filter() function can helps to filter empty elements recursively from multidimensional using PHP. Use the array_map() function with array_filter callback to filter each array in multidimensional array.

By: CodexWorld Oct 2, 2023

When you want to render web page content based on the specific condition, the content needs to be loaded dynamically. In that case, you need to add or remove HTML element from the web page content. Use preg_replace() function to remove HTML tag or element by class or id in PHP.

By: CodexWorld May 28, 2018

The pretty URLs makes webpage URL user-friendly and human readable. Using htaccess file, you can easily create user-friendly URL in the web application. To make URL SEO friendly or user-friendly, you need to create a .htaccess file and define some rewrite rules. The URI segments values can be easily retrieved using PHP.

By: CodexWorld Apr 12, 2018

Regular Expressions (Regex) makes it easy to replace or add attributes to HTML tags in PHP. The preg_replace() function searches string matches to the pattern (regular expression) and replaces with replacement. Use preg_replace() function with regular expression to add attribute to HTML tag using PHP.

By: CodexWorld Mar 13, 2018
keyboard_double_arrow_up