fork(1) download
  1. <?php
  2.  
  3. $groups = array(
  4. 'label' => '',
  5. 'value' => ''
  6. ),
  7. 'label' => 'test',
  8. 'value' => 'test'
  9. )
  10. );
  11.  
  12. function validate($var)
  13. {
  14. return !empty($var['label']);
  15. }
  16.  
  17. $groups = array_filter($groups, 'validate');
  18. foreach($groups as $a) {
  19. echo "<option value='".$a['value']."'>" . $a['label'] . "<option>";
  20. }
Success #stdin #stdout 0.01s 24400KB
stdin
Standard input is empty
stdout
<option value='test'>test<option>