Email validation is a required action before submitting the user input in the server-side. The filter_var() function in PHP, provides an easy way for email validation. Use FILTER_VALIDATE_EMAIL filter to validate an e-mail address in PHP.

By: CodexWorld Feb 7, 2018

$_SERVER is a superglobal variable in PHP, that provides information about headers, paths, and script locations. Use $_SERVER to get current page URL in PHP. If you want to get current page URL with query string, use QUERY_STRING in $_SERVER.

By: CodexWorld Nov 26, 2021

The Regular Expression (REGEX) is the easiest way to validate full name format in PHP. You can easily validate first and last name using regular expression in PHP. Use PHP preg_match() function to perform a regular expression match.

By: CodexWorld Jan 11, 2018

The URL segments are used for many purposes in the web application. You can parse URL segment easily using parse_url() function in PHP. Use parse_url() and array_pop() function to get URI segments and last URL segment using PHP.

By: CodexWorld Apr 15, 2023

The file extension is very useful for validation and upload. You can easily get extension from the file name or file location using PHP. The pathinfo() function provides the easiest way to get file information in PHP. Also, you can use substr() and strrchr() function to get file extension in PHP.

By: CodexWorld Nov 27, 2017

PHP $_SERVER variable provides an easy way to get user IP address. The simplest way to get the visitor IP address is using the REMOTE_ADDR in PHP. Use $_SERVER[‘REMOTE_ADDR’] to get IP address of the user in PHP. Alternatively, use HTTP_X_FORWARDED_FOR to get real IP address of user in PHP.

By: CodexWorld Nov 19, 2023

Code optimization can reduce the execution time of the script. Using the looping statements, you can get an array of a specific key from the multidimensional array. But the same work can be done in a single line of code by array_column() function in PHP.

By: CodexWorld Jul 5, 2017

PHP array_filter() function filters elements of an array by a callback function and it can be used for many purposes. The array_filter() function provides a short and simple way to filter multidimensional array by key and value. Use array_filter() to filter values from multidimensional array similar to SQL LIKE using array_filter() function in PHP.

By: CodexWorld Jan 4, 2023

By default, PHP allows uploading maximum 2 MB file on the server. But you can change the maximum size of file upload as per your requirement. Using the PHP configuration file (php.ini), you can increase or decrease the file upload size in PHP.

By: CodexWorld May 7, 2017
keyboard_double_arrow_up