PHP shuffle() functionThe 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 Functions
|