1--TEST-- 2json_encode() with JSON_PRETTY_PRINT 3--FILE-- 4<?php 5function encode_decode($json) { 6 $struct = json_decode($json); 7 $pretty = json_encode($struct, JSON_PRETTY_PRINT); 8 echo "$pretty\n"; 9 $pretty = json_decode($pretty); 10 printf("Match: %d\n", $pretty == $struct); 11} 12 13encode_decode('[1,2,3,[1,2,3]]'); 14encode_decode('{"a":1,"b":[1,2],"c":{"d":42}}'); 15?> 16--EXPECT-- 17[ 18 1, 19 2, 20 3, 21 [ 22 1, 23 2, 24 3 25 ] 26] 27Match: 1 28{ 29 "a": 1, 30 "b": [ 31 1, 32 2 33 ], 34 "c": { 35 "d": 42 36 } 37} 38Match: 1 39