fork(5) download
  1. <?php
  2. $input = array("Name1","Name2", "Name3","Name4");
  3.  
  4. ?>
  5. <table border=1>
  6.  
  7. <tr>
  8.  
  9. <th> Samedi </th> <th> Dimanche </th> <th> Lundi </th> <th> Mardi </th> <th> Merecredi </th> <th> Jeudi </th> <th> Vendredi </th>
  10. </tr>
  11. <tr>
  12. <?php
  13. $last_shift = $input[array_rand($input)];
  14.  
  15. for($i=0;$i<7;$i++){
  16.  
  17. echo "<td>\n";
  18. shuffle($input);
  19. while ($input[0] == $last_shift) {
  20. shuffle($input);
  21. }
  22. echo $input[0] ." 7H-15H\n" ;
  23. echo $input[1] ." 15H-23H\n" ;
  24. echo $input[2] ." 23H-7H\n" ;
  25.  
  26. $last_shift = $input[2];
  27. echo "</td>\n";
  28. }
  29. ?>
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
<table  border=1>

<tr>

<th> Samedi </th> <th> Dimanche </th> <th> Lundi </th> <th> Mardi </th> <th> Merecredi </th> <th> Jeudi </th> <th> Vendredi </th>
</tr>
<tr>
<td>
Name3 7H-15H
Name4 15H-23H
Name2 23H-7H
</td>
<td>
Name4 7H-15H
Name3 15H-23H
Name2 23H-7H
</td>
<td>
Name1 7H-15H
Name4 15H-23H
Name2 23H-7H
</td>
<td>
Name1 7H-15H
Name3 15H-23H
Name2 23H-7H
</td>
<td>
Name3 7H-15H
Name2 15H-23H
Name4 23H-7H
</td>
<td>
Name3 7H-15H
Name2 15H-23H
Name4 23H-7H
</td>
<td>
Name3 7H-15H
Name4 15H-23H
Name2 23H-7H
</td>