Category: PHP

PHP array() Function

Create an indexed array named $name, assign two elements to it, and then print a text containing the array values. In PHP, there are three types of arrays. Indexed arrays – Arrays with numeric index Associative arrays – Arrays with named keys Multidimensional arrays – Arrays containing one or more arrays Ouptput

PHP Filters

Validate an Integer Within a Range <!DOCTYPE html> <html> <body> <?php /* variable to check */ $int = 12; /* min value */ $min = 1; /* max value */ $max = 20; if (filter_var($int, FILTER_VALIDATE_INT, array(“options” => array(“min_range”=>$min, “max_range”=>$max))) === false) { echo(“Variable value is not within the range”); } else { echo(“Variable value […]

PHP array_change_key_case() Function

The array_change_key_case() function changes all keys in an array to lowercase to uppercase and array_change_key_case() function changes all keys in an array to uppercase to lowercas. CASE_LOWER – Default value. Changes the keys to lowercase CASE_UPPER – Changes the keys to uppercase CASE_LOWER Output CASE_UPPER Output