fork(1) download
  1. <?php
  2.  
  3. $a = array(
  4. 'a1' => 1,
  5. 'b1' => 'a',
  6. 'a2' => 2,
  7. 'b2' => 'b',
  8. 'a3' => 3,
  9. 'b3' => 'c',
  10. );
  11.  
  12.  
  13. $x = preg_grep('/b[0-9]+/', array_keys($a));
  14.  
  15.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(3) {
  ["b1"]=>
  string(1) "a"
  ["b2"]=>
  string(1) "b"
  ["b3"]=>
  string(1) "c"
}