fork download
  1. <?php
  2. $clientes = array(
  3. "nome" => "Cliente 1",
  4. "categoria" => "Turismo",
  5. "logo" => "turismo.jpg"
  6. ),
  7. "nome" => "Suporte",
  8. "categoria" => "Tecnologia",
  9. "logo" => "suporte.jpg"
  10. ),
  11. "nome" => "Faculdade Futura",
  12. "categoria" => "Educação",
  13. "logo" => "faculdade-futura.jpg"
  14. ));
  15. $tmp = $clientes;
  16. shuffle(array_slice(tmp, 15, count($clientes) - 15));
  17. $novo = array_merge(array_slice($clientes, 0, 15), array_slice($tmp, 0, 30));
  18. foreach ($novo as $atributo => $valor):
  19. echo "{$valor["nome"]}\n";
  20. endforeach;
  21.  
  22. //https://pt.stackoverflow.com/q/345270/101
Success #stdin #stdout #stderr 0s 82560KB
stdin
Standard input is empty
stdout
Cliente 1
Suporte
Faculdade Futura
Cliente 1
Suporte
Faculdade Futura
stderr
PHP Notice:  Use of undefined constant tmp - assumed 'tmp' in /home/TNVJL7/prog.php on line 19
PHP Warning:  array_slice() expects parameter 1 to be array, string given in /home/TNVJL7/prog.php on line 19
PHP Notice:  Only variables should be passed by reference in /home/TNVJL7/prog.php on line 19
PHP Warning:  shuffle() expects parameter 1 to be array, null given in /home/TNVJL7/prog.php on line 19