shuffle()
functionYou can use the PHP shuffle()
function to randomly shuffle the order of the elements or values in an array. The shuffle()
function returns FALSE
on failure.
Let's try out the following example to understand how this function basically works:
<?php
// Creating an array containing a range of elements
$numbers = range(1, 10);
// Randomize the order of array items
shuffle($numbers);
foreach ($numbers as $value){
echo "$value" . "<br>";
}
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to animate the opacity of an element on mouse hover using jQuery
Use the jQuery animate() method You c...How to make HTTP GET and POST Request in ReactJs using Axios
In this React Axios tutorial, we ar...How to get all the users except current logged in user in Laravel
While working in Laravel authentication,...sqlcmd: command not found.
After installing MS SQL server on your l...How to replace all occurrences of a string in JavaScript
Use the JavaScript replace() method Y...