a::shuffle($array)

Shuffles an array and keeps the keys

  • $array (array)
    The source array
  • return (array)
    The shuffled result array

Example

<?php
$array = array(
  'cat'  => 'miao',
  'dog'  => 'wuff',
  'bird' => 'tweet'
);

$shuffled = a::shuffle($array);

// output: array(
//   'dog' => 'wuff',
//   'cat' => 'miao',
//   'bird' => 'tweet'
// );