G2A Many GEOs

json_encode null to empty string

krot Apr 12th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $a=[1=>1,'"hj'=>null,'hh'=>[1=>2,'h'=>null]];
  2. array_walk_recursive($a, function  (&$item, $key)
  3. {
  4.     //$item = utf8_encode($item);
  5.     $item=is_null($item)?'':$item;
  6. });
  7. $a=json_encode($a );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand