json - Different result of php json_encode pretty print on macosx and linux -
i have code generator, developers run on local computers can use different versions of php , operation systems. so, there's different behaviour of json_encode pretty print between php 5.5 on mac os x , linux.
mac os x:
php -r "echo json_encode(['a' => []], json_pretty_print);" { "a": [] }
linux:
php -r "echo json_encode(['a' => []], json_pretty_print);" { "a": [ ] }
since json commited git repo has same no matter php build used.
could why there such difference , can do? right now, have 1 solution make like:
$generated_code = preg_replace("#\\[\s+\\]#", "[]", $generated_code);
Comments
Post a Comment