PHP usort() Function

PHP usort() Function The usort() function in PHP sorts  array by values using a user-defined comparison function. Syntax

array(required)– This parameter represents the input array. value_compare_func(required)– This parameter represents a string that describe a callable comparison function. The comparison …

Read morePHP usort() Function

PHP uksort() Function

PHP uksort() Function The uksort() function in PHP sorts an array by keys using a user-defined comparison function. Syntax

Parameter array(required)– This parameter represents the input array. key_compare_func(required)– This parameter represents a string that describe a callable comparison function. …

Read morePHP uksort() Function

PHP uasort() Function

PHP uasort() Function The uasort() function in PHP sorts an array with a user-defined comparison function and maintains the index association. Syntax

Parameter array(required)– This parameter represents the input array. value_compare_func(required)– This parameter represents a string that describe a …

Read morePHP uasort() Function

PHP sort() Function

PHP sort() Function The sort() function in PHP sorts an array where the elements will be arranged from lowest to highest. Syntax

Parameter array(required)– This parameter represents the input array. sort_flags (optional)– This parameter is used to modify the behavior …

Read morePHP sort() Function

PHP sizeof() Function

PHP sizeof() Function The sizeof() function in counts all elements and return the size of the array. This function is an alias of count(). Syntax

Parameter array_or_countable(required)– This parameter represents the input array or countable object. mode(optional)– This parameter …

Read morePHP sizeof() Function

PHP shuffle() Function

PHP shuffle() Function The shuffle() function in PHP shuffles an array in a random array. Syntax

Parameter array(required)– This parameter represents the input array.  Return This parameter returns a Boolean value TRUE on success or FALSE on failure. Example 1

Output …

Read morePHP shuffle() Function

PHP rsort() Function

PHP rsort() Function The rsort () function in PHP is used to sort an array in reverse order i.e., highest to lowest. Syntax

Parameter array(required)– This parameter represents the input array. sort_flags (optional)– This parameter is used to modify the …

Read morePHP rsort() Function

PHP reset() Function

PHP reset() Function The reset() function in PHP is used to set the internal pointer of an array to its first element and returns the value of the first array element. Syntax

Parameter array(required)– This parameter represents the input …

Read morePHP reset() Function

PHP range() Function

PHP range() Function The range () function in PHP is used to create an array containing a range of elements. Syntax

Parameter start(required)– This parameter represents the first value of the sequence. end(required)– This parameter represents the last sequence value …

Read morePHP range() Function

PHP prev() Function

PHP prev() Function The prev() function in PHP rewinds or moves back the internal array pointer one place backward and returns the prev array value. It behaves like next() function, except that this function rewinds the internal array pointer one …

Read morePHP prev() Function

PHP pos() Function

PHP pos() Function The pos() function in PHP returns the current element in an array which is initialized to the first element of the array. This function is an alias of current(). Syntax

Parameter array(required)– This parameter represents the …

Read morePHP pos() Function

PHP next() Function

PHP next() Function The next() function in PHP advances or moves the internal array pointer one place forward and returns the next array value. Syntax

Parameter array(required)– This parameter represents the input array. Return This parameter returns the next …

Read morePHP next() Function

PHP natsort() Function

PHP natsort() Function The natsort() function in PHP Sort an array using a case insensitive “natural order” algorithm while maintaining the keys. Syntax

Parameter array(required)– This parameter represents the input array. Return This parameter returns a Boolean value TRUE on …

Read morePHP natsort() Function

PHP natcasesort() Function

PHP natcasesort() Function The natcasesort() function in PHP Sort an array using a case insensitive “natural order” algorithm while maintaining the keys. Syntax

Parameter array(required)– This parameter represents the input array. Return This parameter returns a Boolean value TRUE on …

Read morePHP natcasesort() Function

PHP list() Function

PHP list() Function The list() function in PHP sorts an array by key while maintaining the keys. Syntax

Parameter var1(required)– This parameter accepts variables separated by spaces. …(optional)– This parameter accepts a list of variables separated by spaces. Return …

Read morePHP list() Function

PHP ksort() Function

PHP ksort() Function The ksort() function in PHP sorts an array by key while maintaining the keys. Syntax

Parameter array(required)– This parameter represents the input array. sort_flags(optional)– This parameter is used to modify the behavior of the sort. The …

Read morePHP ksort() Function

PHP krsort() Function

PHP krsort() Function The krsort() function in PHP sorts an array by key in reverse order while maintaining the keys. Syntax

Parameter array(required)– This parameter represents the input array. sort_flags(optional)– This parameter is used to modify the behavior of …

Read morePHP krsort() Function

PHP key() Function

PHP key() Function The key() function in PHP fetches a key from an array and returns the index element of the current array position. Syntax

Parameter array(required)– This parameter represents the input array. Return This function returns the key …

Read morePHP key() Function

PHP key_exists() Function

PHP key_exists() Function The key_exists() function in PHP checks if the specified key or index exists in the array or not. Syntax

Parameter key(required)– This parameter represents the value to check. array(required)– This parameter signifies an input array with …

Read morePHP key_exists() Function

PHP in_array() Function

PHP in_array() Function The in_array() function in PHP checks if the value exists in the specified array or not. Syntax

Parameter needle(required)– This parameter represents the searched value. haystack(required)– This parameter represents the input array. strict(optional)- This parameter searches …

Read morePHP in_array() Function