fork download
  1. <?php
  2. function IsNonEmptyString($x){
  3. return $x !== "";
  4. }
  5.  
  6. $arr = array(1 =>"東京",2=>"京都",3=> "",7=>"横浜",24=>"奈良",5=> "");
  7. $arr = array_filter($arr,"IsNonEmptyString");
  8. print_r($arr);
  9.  
  10. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Array
(
    [1] => 東京
    [2] => 京都
    [7] => 横浜
    [24] => 奈良
)