fork(1) download
  1. <?php
  2.  
  3. // code by l'L'l
  4.  
  5. $array = array (
  6. 'empid' => 'UPW_OB_8',
  7. 'TotalLoginHrs' => '0',
  8. 'status' => 'id not used',
  9. '20140401' => 1,
  10. '20140402' => null,
  11. '20140403' => 2,
  12. '20140404' => null,
  13. '20140405' => 1,
  14. '20140406' => null,
  15. '20140407' => 9,
  16. '20140408' => null,
  17. '20140409' => 3,
  18. '20140410' => null,
  19. '20140411' => 5,
  20. '20140412' => ''
  21. );
  22.  
  23. $replaced = preg_replace("/^$/u", "0", $array);
  24. print_r($replaced);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [empid] => UPW_OB_8
    [TotalLoginHrs] => 0
    [status] => id not used
    [20140401] => 1
    [20140402] => 0
    [20140403] => 2
    [20140404] => 0
    [20140405] => 1
    [20140406] => 0
    [20140407] => 9
    [20140408] => 0
    [20140409] => 3
    [20140410] => 0
    [20140411] => 5
    [20140412] => 0
)