fork download
  1. <?php
  2.  
  3. $img = array(
  4. array("1.jpg","Logo","Tigre"),
  5. array("2.jpg","Logo","Cão"),
  6. array("3.jpg","Logo","Montanha"),
  7. array("4.jpg","banner","Design Grafico"),
  8. array("5.jpg","Logo","Dentista"),
  9. array("6.jpg","Logo","Basketball")
  10. );
  11.  
  12. echo 'Antes:', PHP_EOL;
  13.  
  14. var_dump($img);
  15.  
  16. shuffle($img);
  17.  
  18. echo 'Depois:', PHP_EOL;
  19.  
  20. var_dump($img);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Antes:
array(6) {
  [0]=>
  array(3) {
    [0]=>
    string(5) "1.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(5) "Tigre"
  }
  [1]=>
  array(3) {
    [0]=>
    string(5) "2.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(4) "Cão"
  }
  [2]=>
  array(3) {
    [0]=>
    string(5) "3.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(8) "Montanha"
  }
  [3]=>
  array(3) {
    [0]=>
    string(5) "4.jpg"
    [1]=>
    string(6) "banner"
    [2]=>
    string(14) "Design Grafico"
  }
  [4]=>
  array(3) {
    [0]=>
    string(5) "5.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(8) "Dentista"
  }
  [5]=>
  array(3) {
    [0]=>
    string(5) "6.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(10) "Basketball"
  }
}
Depois:
array(6) {
  [0]=>
  array(3) {
    [0]=>
    string(5) "6.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(10) "Basketball"
  }
  [1]=>
  array(3) {
    [0]=>
    string(5) "5.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(8) "Dentista"
  }
  [2]=>
  array(3) {
    [0]=>
    string(5) "2.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(4) "Cão"
  }
  [3]=>
  array(3) {
    [0]=>
    string(5) "3.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(8) "Montanha"
  }
  [4]=>
  array(3) {
    [0]=>
    string(5) "1.jpg"
    [1]=>
    string(4) "Logo"
    [2]=>
    string(5) "Tigre"
  }
  [5]=>
  array(3) {
    [0]=>
    string(5) "4.jpg"
    [1]=>
    string(6) "banner"
    [2]=>
    string(14) "Design Grafico"
  }
}