Most Referenced Functions
  » google_pagerank()
  » preg_replace()
  » imagecreatefrompng()
  » site_pageranks()
  » imagepng()
  » imagedestroy()
  » imagestring()
  » imagecolorallocate()
  » htmlentities()
  » fopen()
  » preg_match()
  » header()
  » getimagesize()
  » htmlspecialchars()
  » ob_start()
  » session_start()
  » strstr()
  » ob_flush()
  » preg_match_all()
  » strpos()
  » flush()
  » setcookie()
  » str_replace()
  » array2vars()
  » nl2br()
  » preg_split()
  » ereg()
  » urlencode()
  » ereg_replace()
  » readgzfile()

Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m.

PHP Functions

Function: shuffle

(PHP 3 >= 3.0.8, PHP 4, PHP 5)

shuffle -- Shuffle an array

Description

bool shuffle ( array &array )

This function shuffles (randomizes the order of the elements in) an array.

Example 1. shuffle() example

<?php
$numbers = range(1, 20);
srand((float)microtime() * 1000000);
shuffle($numbers);
foreach ($numbers as $number) {
    echo "$number ";
}
?>

Note: As of PHP 4.2.0, there is no need to seed the random number generator with srand() or mt_srand() as this is now done automatically.

Related Function(s)

  • srand()
  • mt_srand()
  • arsort()
  • asort()
  • ksort()
  • rsort()
  • sort()
  • usort()
  • Icemelon -- PHP, CSS, Javascript Tutorials, & More!
      © 2005-2010 Icemelon.com   Email: dave[AT]icemelon[D0T]c0m