Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $arr = [0,1,2,3,4,5,6,7,8,9]; $cnt = count($arr); $shuffled = []; while ($cnt>0) { $shuffled = array_merge($shuffled, array_splice($arr, rand(0, $cnt), 1)); $cnt--; } print_r($shuffled);
Copy Clear