fork download
  1. <?php
  2. $families = array(
  3. "Griffin" => array(
  4. "Peter",
  5. "Louis",
  6. "Chris",
  7. "Stewie",
  8. "Meg"
  9. ));
  10.  
  11. $the_array = 'families';
  12. $answer = 'Peter';
  13. $array_key = 'Griffin';
  14.  
  15. $the_array = ($$the_array);
  16. if (in_array($answer, $the_array[$array_key])) {
  17. echo "you nailed it";
  18. } else {
  19. echo "neah";
  20. }
  21.  
  22. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
you nailed it