PHP shuffle() Function6 Jan 2025 | 1 min read The PHP shuffle( ) function is used to randomize the order of the elements in the array. The function assigns new keys to the elements in an array. This function introduced in PHP 4.0. SyntaxParameter
ReturnsThe shuffle( ) function returns true on success or false on failure. Example 1Output- Every time output is random Array ( [0] => networking [1] =>dbms [2] =>os [3] => compiler [4] => java ) Example 2Output- Every time output is random ( [0] =>bangalore [1] =>hyderabad [2] =>kolkata ) Example 3Output- Every time output is random Array ( [0] => apple [1] => banana [2] => mango ) Example 4Output- Every time output is random Array ( [0] => 4 [1] => 5 [2] => 3 [3] => 2 [4] => 1 ) Next TopicPhp-array-sizeof-function |
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 uasort() Function The PHP uasort( ) function is used to sort an array by its values using a user-defined comparison function. This function was introduced in PHP 4.0. Syntax bool uasort ( array &$array , callable $value_compare_func ); Parameter Parameter Description Is compulsory array Specifies the array to be sorted. compulsory user_defined_function This function is a...
2 min read
The each( ) function is an inbuilt function of PHP. It is used to fetch the key and value of the current element and moves the internal pointer forward. This function was introduced in PHP 4.0. Syntax array each ( array &$array ); Parameter Parameter Description Is compulsory array Specifies the array to...
1 min read
This function is inbuilt in PHP and it was introduced in PHP 5. The function array_diff_uassoc() is used to compute the difference of arrays with additional index check which is performed by a user supplied callback function. In simple words, the function compares array1 against array2...
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_uintersect_assoc( ) function is an inbuilt function of PHP. The array_uintesect_assoc() function compares two or more arrays, and then returns an array containing the elements from the first array. This function was introduced in PHP 5.0. Syntax array array_uintersect_assoc ( array $array1 , array $array2 [,...
1 min read
The array_intersect_key( ) function computes the intersection of arrays using keys for comparison. This function compares the keys of two or more arrays and returns the matches. This function compares the keys of two or more arrays and returns an array that contains the entries...
1 min read
The array_rand()function is a inbuilt function in PHP. The array_rand()function is used to fetch one or more random entries from an array. It uses a pseudo-random number generator that is not suitable for cryptographic purposes. This function was introduced in PHP 4.0. Syntax mixed array_rand ( array...
1 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. Syntax bool in_array ( mixed...
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
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