fork(1) download
  1. <?php
  2. $goods = [
  3. [
  4. 'name' => 'the good',
  5. 'spec' => array('mall', 'discount', 'promotion')
  6. ],
  7. [
  8. 'name' => 'other good',
  9. 'spec' => array('discount', 'promotion')
  10. ],
  11. [
  12. 'name' => 'no good',
  13. 'spec' => array('promotion')
  14. ],
  15. ];
  16.  
  17. foreach ($goods as $good)
  18. {
  19. foreach ($good[spec] as $mall)
  20. {
  21. if ($mall == 'mall')
  22. {
  23. $rate_mall .= 'mall';
  24. }
  25. }
  26.  
  27. if ($rate_mall)
  28. {
  29. echo 'Yes';
  30. } else {
  31. echo 'No';
  32. }
  33. }
  34. ?>
  35.  
Success #stdin #stdout #stderr 0s 52488KB
stdin
Standard input is empty
stdout
YesYesYes
stderr
PHP Notice:  Use of undefined constant spec - assumed 'spec' in /home/dRUMFX/prog.php on line 19
PHP Notice:  Undefined variable: rate_mall in /home/dRUMFX/prog.php on line 23
PHP Notice:  Use of undefined constant spec - assumed 'spec' in /home/dRUMFX/prog.php on line 19
PHP Notice:  Use of undefined constant spec - assumed 'spec' in /home/dRUMFX/prog.php on line 19