fork download
  1. <?php
  2.  
  3. $test = [
  4. 'Who are you?' => ["Neo", "Morpheus", "Trinity", "Cypher", "Tank"],
  5. 'How old are you?' => ['10', '25', '40', '60', '90']
  6. ];
  7.  
  8. $questions = array_keys($test);
  9.  
  10. shuffle($questions);
  11.  
  12. foreach ($questions as $question) {
  13. $answers = $test[$question];
  14. shuffle($answers);
  15.  
  16. echo $question . PHP_EOL;
  17. foreach ($answers as $answer) {
  18. echo $answer . PHP_EOL;
  19. }
  20. }
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Who are you?
Tank
Morpheus
Cypher
Neo
Trinity
How old are you?
10
40
25
90
60