PHP prev() Function6 Jan 2025 | 1 min read The PHP prev( ) function is used to fetch the array value in the previous place, pointed by the internal array pointer. This function was introduced in PHP 4.0. SyntaxParameter
ReturnsThe prev( ) function returns the value of the previous element in the array on success or false if there are no more elements. Example 1Output: php Java Example 2Output: Java php Java Example 3Output: arctic antarctic arctic Example 4Output: arctic indian arctic arctic Next TopicPhp-array-product-function |
The array_diff() function compares two or more arrays and returns an array with the keys and values from the first array, only if the value is not present in any of the other arrays. This function was introduced in PHP 4.0. Syntax array_diff(array1,array2,array3...); Parameter Description Is compulsory array1 The array to compare...
2 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
PHP ksort() Function The PHP ksort() sorts an associative array in ascending order, according to the key. It is mainly used for an associative array. This function was introduced in PHP 4.0. Syntax bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] ); Parameter Parameter Description Is compulsory array Specifies the array...
1 min read
The array_intersect_assoc() is used to create an array containing keys and values of the first array whose values (i.e., from the first array) are present in all other arrays, while the index of values is same for all the given arrays. This function was introduced...
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 compact( ) function is an inbuilt function of PHP, and it is used to create an array from variables and their values. This function was introduced in PHP 4+. Syntax array compact ( mixed $varname1 [, mixed $... ] ); Parameters Parameter Description Is compulsory Variable1 It can be either a string...
1 min read
It is an inbuilt function in PHP. The array_column() function is used to return the values from a single column in the input array. This function is introduced in PHP 5.5. Syntax array_column(array,column_key,index_key); Parameter Description Is compulsory array Specifies the multi-dimensional array to use compulsory Column_key This parameter may be an integer or a string...
2 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
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_slice() function is an inbuilt function of PHP. The array_slice() function is used to extract a slice of an array. This function was introduced in 4.0. Syntax array array_slice ( array $array , int $offset [, int $length = NULL [, bool $preserve_keys = FALSE ]]...
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