PHP in_array() Function6 Jan 2025 | 2 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. SyntaxParameter
ReturnsThe function returns true if the value is found in the array or false otherwise. Example 1Output: found Example 2Output: Got jobGot innovation Example 3Output: great player Example 4Output: found not found Next TopicPhp-array-intersect-assoc-function |
The array_intersect_ukey( ) function Computes the intersection of arrays using a callback function on the keys for comparison. The function returns an array containing all the values of the first array which have matching keys that are present in all the arguments. This function was...
1 min read
PHP () Function The PHP ( ) function is used to advance the internal array pointer. It advances the internal array pointer one place forward before returning the element value. This function was introduced in PHP 4.0. Syntax mixed ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to...
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
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. Syntax array array_values ( array $array ); Parameters Parameter Description Is compulsory array Specifying an array. compulsory Return Values The array_values( )...
1 min read
The array_pop() function is inbuilt function of PHP. The array_pop() function is used to remove the last element of an array. For an empty array, this function returns NULL. This function was introduced in PHP 4.0. Syntax mixed array_pop ( array &$array ); Parameters Parameter Description Required/Optional array Specifies an array. compulsory Return Type The array_pop()...
1 min read
The array_splice() function is an extended version of array_slice() function. The array_splice() function removes selected elements from an array and replaces it with new elements. This function was introduced in PHP 4. Syntax arrayarray_splice ( array &$input , int $offset [, int $length = count($input) [, mixed...
1 min read
PHP reset() Function The PHP reset( ) function is used to move the array's internal pointer to the first element. This function was introduced in PHP 4.0. Syntax mixed reset ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Returns The reset( ) function returns the value of the first...
1 min read
The array_merge( ) function is a built-in function of PHP. This function is used to merge the elements or values of two or more arrays together into a single array. This function was introduced in PHP 4.0. Syntax array array_merge(array $array1[, array $...]); Parameter Parameter Description Is compulsory array1 Specifies an array. compulsory array2 Specifies an...
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_intersect_uassoc( ) function is an inbuilt function in PHP. The array_intersect_uassoc( ) function is used to compare key and values of two or more arrays by using a user-defined comparison function and return the matches. It returns an array containing all the values of...
2 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