PHP array_values() Function6 Jan 2025 | 1 min read The array_values( ) function is an inbuilt function of PHP. It is used to get an array of values from another array that may contain key-value pairs. This function was introduced in PHP 4.0. SyntaxParameters
Return ValuesThe array_values( ) function returns an array containing all the values of an array. Important note:The returned array will have numeric keys, starting at 0 and increase by 1. Example 1Output: Array ( [0] =>javatpoint [1] =>udemy [2] =>byjus ) Example 2Output: Array ( [0] => apple [1] => ball [2] => cat ) Example 3Output: Array ( [0] =>mario [1] => need for speed [2] =>igi [3] => road race ) Example 4Output: Array ( [0] =>Narendramodi [1] => 67 [2] => INDIA ) Next TopicPhp-array-walk-function |
The array_reverse() function is a inbuilt function of PHP. The array_reverse( ) function is used to reverse the order of the elements in an array. This function was introduced in PHP 4.0. Syntax array array_reverse ( array $array [, bool $preserve_keys = FALSE ] ); Parameter Parameter Description Is compulsory array Specifies an...
1 min read
PHP sizeof() Function The sizeof( ) function is an alias of count( ) function. The sizeof( ) function returns the number of elements in an array. This function was introduced in PHP 4.0. Syntax intsizeof(array, mode); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory mode Specifies the mode. Possible values: 0 - Default. Does...
1 min read
The in_array( ) function is an inbuilt function of PHP. It is used to search an array for a specific value. If the third parameter strict is set to true, the in_array( ) function will also check the types of the $values. Syntax bool in_array ( mixed...
1 min read
PHP current() Function The current( ) function is an inbuilt function of PHP, and it is used to return the value of the current element in an array. This function was introduced in PHP 4.0. Syntax mixed current ( array $array ); Parameters Parameter Description Is compulsory array Specifies the array to use. compulsory Return Values The...
1 min read
PHP extract() Function The extract( ) function is an inbuilt function of PHP, and it is used to import variables into the local symbol table from an array. This function was introduced in 4.0. Syntax int extract ( array &$array [, int $flags = EXTR_OVERWRITE [, string $prefix...
1 min read
The array_udiff( ) function is an inbuilt function of PHP. The array_udiff( ) function is used to compute the difference of given arrays by using a callback function for data comparison. This function was introduced in PHP 5.1.0. Syntax array array_udiff ( array $array1 , array $array2...
1 min read
PHP array_change_key_case() Function It is an inbuilt function of PHP. The array_change_key_case() function returns an array with all arrays keys in lower case or upper case. Syntax array_change_key_case(array,case); Parameter Description Is compulsory array Specifies the array to use compulsory case Case to use(Upper or Lower) optional Important Note: If the second parameter is avoided then by default the...
1 min read
The array_udiff_uassoc( ) function is an inbuilt function of PHP. The array_udiff_uassoc( ) function compares two or more arrays in two user-made functions, and returns an array containing the elements from the first array. This function was introduced in PHP 5.0. Syntax array array_udiff_uassoc ( array $array1...
2 min read
The array_reduce() function is a inbuilt function of PHP. The array_reduce( ) function is used to reduce the array to a single value using a callback function. This function was introduced in PHP 4.0.5. Syntax mixed array_reduce ( array $array , callable $callback [, mixed $initial =...
1 min read
PHP key() Function The key( ) function returns the element key from the current internal pointer position. This function was introduced in 4.0. Syntax mixed key ( array $array ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Returns The key( ) returns the key of the array element that is currently being...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India