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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -