PHP array_search() Function6 Jan 2025 | 1 min read The array_search() function is an inbuilt function of PHP. It is used to search the array against the given value. The function returns the first corresponding key if successful. This function was introduced in PHP 4.0.5. SyntaxParameter
Return typeThe array_search() function returns the key of the corresponding value that is passed. If not found, FALSE is returned, and if there are more than one matches, the first matched key is returned. Example 1Output: 3 Example 2Output: a Example 3Output: b Example 4Output: 5 Next TopicPhp-array-shift-function |
The array_key_last( ) function is used to get the last key of an array. This function was introduced in PHP 7.3.0 Syntax mixed array_key_last ( array $array ); Parameters Parameter Description Is compulsory array Specifies the array. compulsory Return Values The array_key_last( ) function returns the last key of the array if the array is not...
1 min read
PHP list() Function The PHP list( ) function is used to assign values to a list of variables in one operation. This function was introduced in PHP 4.0. Syntax array list ( mixed $var1 [, mixed $... ] ); Parameter Parameter Description Is compulsory Variable1 The first variable to assign a value to. compulsory Variable2... More variables...
1 min read
The array_replace() function is a built-in function in PHP. The PHP array_replace( ) function is used to replace the values of the first array with the values from following arrays. This function was introduced in PHP 5.3.0. Syntax array array_replace ( array $array1 [, array $... ]...
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_sum( ) function is an inbuilt function of PHP. The array_sum( ) function calculates the sum of values in an array and returns the sum of values in an array as an integer or float. This function was introduced in PHP 4.0.4. Syntax number array_sum (...
1 min read
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
The array_uintersect() is an inbuilt function in PHP. It is used to compute the intersection of two or more arrays depending on the values. The first array values are compared with all the other arrays with the help of an user-defined function, and the matches...
1 min read
The array_arsort( ) function is an inbuilt function of PHP. The array_arsort( ) function is used to sort an array in reverse order and the function maintains index association. This function was introduced in 4.0. Syntax bool arsort ( array &$array [, int $sort_flags = SORT_REGULAR ]...
1 min read
The array_unshift( ) function is an inbuilt function of PHP. It is used to add one or more elements to the beginning of an array. This function was introduced in PHP 4.0. Syntax int array_unshift ( array &$array [, mixed $... ] ); Parameters Parameter Description Is compulsory array The input array. compulsory List of...
1 min read
PHP rsort() Function The PHP rsort( ) function is used to sort an array in reverse order. This function introduced in PHP 4.0. Syntax bool rsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Sort flags It specifies how to sort the array...
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