PHP array_pop() Function6 Jan 2025 | 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. SyntaxParameters
Return TypeThe array_pop() function returns the last value of array. If the array is empty or is not an array, this method will return NULL. Example 1Output: Array ( [0] => saffron [1] => white ) Example 2Output: Array ( [0] =>php [1] => java [2] => python ) Example 3Output: Array ( [1] => 1983 [2] => 2007 ) Example 4Output: Array ( [0] => RBI [1] => SBI [2] => ICICI ) Next TopicPhp-array-pos-function |
PHP end() Function The end( ) function is an inbuilt function of PHP. The end() function Set the internal pointer of an array to its last element. This function was introduced in 4.0. Syntax mixed end ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Returns The end( ) function...
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
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
PHP array_count_values() Function The array_count_values() function returns an array where the keys are the original array's values, and the values is the number of occurrences. In other words, we can say that array_count_values() function is used to calculate the frequency of all of the elements of...
1 min read
PHP natcasesort() Function The natcasesort( ) function is used to sort an array using a case insensitive "natural array" algorithm. The function implements a sort algorithm but maintains original keys and values. This function was introduced in PHP 4.0. Syntax bool natcasesort ( array &$array ); Parameter Parameter Description Is compulsory array The input...
2 min read
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_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 () Function The PHP ( ) function is used to fetch the array value in the ious place, pointed by the internal array pointer. This function was introduced in PHP 4.0. Syntax mixed ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to use. compulsory Returns The ( ) function returns...
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. Syntax mixed array_search ( mixed $needle , array $haystack [, bool...
1 min read
This function is used to flip the array with the keys and values. It takes one parameter that is an array. The returned array will contain the flipped elements. The values will be the keys, and the keys will be the values. This function was...
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