pass001.1_64bit.phpt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. --TEST--
  2. JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
  3. --INI--
  4. serialize_precision=-1
  5. --SKIPIF--
  6. <?php
  7. if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
  8. ?>
  9. --FILE--
  10. <?php
  11. /* Modified to test unescaped UNICODE as keys and values.
  12. * Modified to test numbers with exponents without a decimal point.
  13. * Modified to test empty string values.
  14. * Modified to test a mix of integers and strings as keys.
  15. */
  16. $test = "
  17. [
  18. \"JSON Test Pattern pass1\",
  19. {\"object with 1 member\":[\"array with 1 element\"]},
  20. {},
  21. [],
  22. -42,
  23. true,
  24. false,
  25. null,
  26. {
  27. \"integer\": 1234567890,
  28. \"real\": -9876.543210,
  29. \"e\": 0.123456789e-12,
  30. \"E\": 1.234567890E+34,
  31. \"\": 23456789012E666,
  32. \"E no .\": 4E12,
  33. \"zero\": 0,
  34. \"one\": 1,
  35. \"space\": \" \",
  36. \"quote\": \"\\\"\",
  37. \"backslash\": \"\\\\\",
  38. \"controls\": \"\\b\\f\\n\\r\\t\",
  39. \"slash\": \"/ & \\/\",
  40. \"alpha\": \"abcdefghijklmnopqrstuvwyz\",
  41. \"ALPHA\": \"ABCDEFGHIJKLMNOPQRSTUVWYZ\",
  42. \"digit\": \"0123456789\",
  43. \"special\": \"`1~!@#$%^&*()_+-={':[,]}|;.</>?\",
  44. \"hex\": \"\\u0123\\u4567\\u89AB\\uCDEF\\uabcd\\uef4A\",
  45. \"unicode\": \"\\u30d7\\u30ec\\u30b9\\u30ad\\u30c3\\u30c8\",
  46. \"プレスキット\": \"プレスキット\",
  47. \"empty_string\": \"\",
  48. \"true\": true,
  49. \"false\": false,
  50. \"null\": null,
  51. \"array\":[ ],
  52. \"object\":{ },
  53. \"123\":{\"456\":{\"abc\":{\"789\":\"def\",\"012\":[1,2,\"5\",500],\"ghi\":[1,2,\"five\",50,\"sixty\"]}}},
  54. \"address\": \"50 St. James Street\",
  55. \"url\": \"http://www.JSON.org/\",
  56. \"comment\": \"// /* <!-- --\",
  57. \"# -- --> */\": \" \",
  58. \" s p a c e d \" :[1,2 , 3
  59. ,
  60. 4 , 5 , 6 ,7 ],
  61. \"compact\": [1,2,3,4,5,6,7],
  62. \"jsontext\": \"{\\\"object with 1 member\\\":[\\\"array with 1 element\\\"]}\",
  63. \"quotes\": \"&#34; \\u0022 %22 0x22 034 &#x22;\",
  64. \"\\/\\\\\\\"\\uCAFE\\uBABE\\uAB98\\uFCDE\\ubcda\\uef4A\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?\"
  65. : \"A key can be any string\"
  66. },
  67. 0.5 ,98.6
  68. ,
  69. 99.44
  70. ,
  71. 1066
  72. ,\"rosebud\"]
  73. ";
  74. echo 'Testing:' . $test . "\n";
  75. echo "DECODE: AS OBJECT\n";
  76. $obj = json_decode($test);
  77. var_dump($obj);
  78. echo "DECODE: AS ARRAY\n";
  79. $arr = json_decode($test, true);
  80. var_dump($arr);
  81. echo "ENCODE: FROM OBJECT\n";
  82. $obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR);
  83. echo $obj_enc . "\n";
  84. echo "ENCODE: FROM ARRAY\n";
  85. $arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR);
  86. echo $arr_enc . "\n";
  87. echo "DECODE AGAIN: AS OBJECT\n";
  88. $obj = json_decode($obj_enc);
  89. var_dump($obj);
  90. echo "DECODE AGAIN: AS ARRAY\n";
  91. $arr = json_decode($arr_enc, true);
  92. var_dump($arr);
  93. ?>
  94. --EXPECTF--
  95. Testing:
  96. [
  97. "JSON Test Pattern pass1",
  98. {"object with 1 member":["array with 1 element"]},
  99. {},
  100. [],
  101. -42,
  102. true,
  103. false,
  104. null,
  105. {
  106. "integer": 1234567890,
  107. "real": -9876.543210,
  108. "e": 0.123456789e-12,
  109. "E": 1.234567890E+34,
  110. "": 23456789012E666,
  111. "E no .": 4E12,
  112. "zero": 0,
  113. "one": 1,
  114. "space": " ",
  115. "quote": "\"",
  116. "backslash": "\\",
  117. "controls": "\b\f\n\r\t",
  118. "slash": "/ & \/",
  119. "alpha": "abcdefghijklmnopqrstuvwyz",
  120. "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
  121. "digit": "0123456789",
  122. "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
  123. "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
  124. "unicode": "\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8",
  125. "プレスキット": "プレスキット",
  126. "empty_string": "",
  127. "true": true,
  128. "false": false,
  129. "null": null,
  130. "array":[ ],
  131. "object":{ },
  132. "123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},
  133. "address": "50 St. James Street",
  134. "url": "http://www.JSON.org/",
  135. "comment": "// /* <!-- --",
  136. "# -- --> */": " ",
  137. " s p a c e d " :[1,2 , 3
  138. ,
  139. 4 , 5 , 6 ,7 ],
  140. "compact": [1,2,3,4,5,6,7],
  141. "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
  142. "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
  143. "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
  144. : "A key can be any string"
  145. },
  146. 0.5 ,98.6
  147. ,
  148. 99.44
  149. ,
  150. 1066
  151. ,"rosebud"]
  152. DECODE: AS OBJECT
  153. array(14) {
  154. [0]=>
  155. string(23) "JSON Test Pattern pass1"
  156. [1]=>
  157. object(stdClass)#%d (1) {
  158. ["object with 1 member"]=>
  159. array(1) {
  160. [0]=>
  161. string(20) "array with 1 element"
  162. }
  163. }
  164. [2]=>
  165. object(stdClass)#%d (0) {
  166. }
  167. [3]=>
  168. array(0) {
  169. }
  170. [4]=>
  171. int(-42)
  172. [5]=>
  173. bool(true)
  174. [6]=>
  175. bool(false)
  176. [7]=>
  177. NULL
  178. [8]=>
  179. object(stdClass)#%d (36) {
  180. ["integer"]=>
  181. int(1234567890)
  182. ["real"]=>
  183. float(-9876.54321)
  184. ["e"]=>
  185. float(1.23456789E-13)
  186. ["E"]=>
  187. float(1.23456789E+34)
  188. [""]=>
  189. float(INF)
  190. ["E no ."]=>
  191. float(4000000000000)
  192. ["zero"]=>
  193. int(0)
  194. ["one"]=>
  195. int(1)
  196. ["space"]=>
  197. string(1) " "
  198. ["quote"]=>
  199. string(1) """
  200. ["backslash"]=>
  201. string(1) "\"
  202. ["controls"]=>
  203. string(5) "
  204. "
  205. ["slash"]=>
  206. string(5) "/ & /"
  207. ["alpha"]=>
  208. string(25) "abcdefghijklmnopqrstuvwyz"
  209. ["ALPHA"]=>
  210. string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
  211. ["digit"]=>
  212. string(10) "0123456789"
  213. ["special"]=>
  214. string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
  215. ["hex"]=>
  216. string(17) "ģ䕧覫췯ꯍ"
  217. ["unicode"]=>
  218. string(18) "プレスキット"
  219. ["プレスキット"]=>
  220. string(18) "プレスキット"
  221. ["empty_string"]=>
  222. string(0) ""
  223. ["true"]=>
  224. bool(true)
  225. ["false"]=>
  226. bool(false)
  227. ["null"]=>
  228. NULL
  229. ["array"]=>
  230. array(0) {
  231. }
  232. ["object"]=>
  233. object(stdClass)#%d (0) {
  234. }
  235. ["123"]=>
  236. object(stdClass)#%d (1) {
  237. ["456"]=>
  238. object(stdClass)#%d (1) {
  239. ["abc"]=>
  240. object(stdClass)#%d (3) {
  241. ["789"]=>
  242. string(3) "def"
  243. ["012"]=>
  244. array(4) {
  245. [0]=>
  246. int(1)
  247. [1]=>
  248. int(2)
  249. [2]=>
  250. string(1) "5"
  251. [3]=>
  252. int(500)
  253. }
  254. ["ghi"]=>
  255. array(5) {
  256. [0]=>
  257. int(1)
  258. [1]=>
  259. int(2)
  260. [2]=>
  261. string(4) "five"
  262. [3]=>
  263. int(50)
  264. [4]=>
  265. string(5) "sixty"
  266. }
  267. }
  268. }
  269. }
  270. ["address"]=>
  271. string(19) "50 St. James Street"
  272. ["url"]=>
  273. string(20) "http://www.JSON.org/"
  274. ["comment"]=>
  275. string(13) "// /* <!-- --"
  276. ["# -- --> */"]=>
  277. string(1) " "
  278. [" s p a c e d "]=>
  279. array(7) {
  280. [0]=>
  281. int(1)
  282. [1]=>
  283. int(2)
  284. [2]=>
  285. int(3)
  286. [3]=>
  287. int(4)
  288. [4]=>
  289. int(5)
  290. [5]=>
  291. int(6)
  292. [6]=>
  293. int(7)
  294. }
  295. ["compact"]=>
  296. array(7) {
  297. [0]=>
  298. int(1)
  299. [1]=>
  300. int(2)
  301. [2]=>
  302. int(3)
  303. [3]=>
  304. int(4)
  305. [4]=>
  306. int(5)
  307. [5]=>
  308. int(6)
  309. [6]=>
  310. int(7)
  311. }
  312. ["jsontext"]=>
  313. string(49) "{"object with 1 member":["array with 1 element"]}"
  314. ["quotes"]=>
  315. string(27) "&#34; " %22 0x22 034 &#x22;"
  316. ["/\"쫾몾ꮘﳞ볚
  317. `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
  318. string(23) "A key can be any string"
  319. }
  320. [9]=>
  321. float(0.5)
  322. [10]=>
  323. float(98.6)
  324. [11]=>
  325. float(99.44)
  326. [12]=>
  327. int(1066)
  328. [13]=>
  329. string(7) "rosebud"
  330. }
  331. DECODE: AS ARRAY
  332. array(14) {
  333. [0]=>
  334. string(23) "JSON Test Pattern pass1"
  335. [1]=>
  336. array(1) {
  337. ["object with 1 member"]=>
  338. array(1) {
  339. [0]=>
  340. string(20) "array with 1 element"
  341. }
  342. }
  343. [2]=>
  344. array(0) {
  345. }
  346. [3]=>
  347. array(0) {
  348. }
  349. [4]=>
  350. int(-42)
  351. [5]=>
  352. bool(true)
  353. [6]=>
  354. bool(false)
  355. [7]=>
  356. NULL
  357. [8]=>
  358. array(36) {
  359. ["integer"]=>
  360. int(1234567890)
  361. ["real"]=>
  362. float(-9876.54321)
  363. ["e"]=>
  364. float(1.23456789E-13)
  365. ["E"]=>
  366. float(1.23456789E+34)
  367. [""]=>
  368. float(INF)
  369. ["E no ."]=>
  370. float(4000000000000)
  371. ["zero"]=>
  372. int(0)
  373. ["one"]=>
  374. int(1)
  375. ["space"]=>
  376. string(1) " "
  377. ["quote"]=>
  378. string(1) """
  379. ["backslash"]=>
  380. string(1) "\"
  381. ["controls"]=>
  382. string(5) "
  383. "
  384. ["slash"]=>
  385. string(5) "/ & /"
  386. ["alpha"]=>
  387. string(25) "abcdefghijklmnopqrstuvwyz"
  388. ["ALPHA"]=>
  389. string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
  390. ["digit"]=>
  391. string(10) "0123456789"
  392. ["special"]=>
  393. string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
  394. ["hex"]=>
  395. string(17) "ģ䕧覫췯ꯍ"
  396. ["unicode"]=>
  397. string(18) "プレスキット"
  398. ["プレスキット"]=>
  399. string(18) "プレスキット"
  400. ["empty_string"]=>
  401. string(0) ""
  402. ["true"]=>
  403. bool(true)
  404. ["false"]=>
  405. bool(false)
  406. ["null"]=>
  407. NULL
  408. ["array"]=>
  409. array(0) {
  410. }
  411. ["object"]=>
  412. array(0) {
  413. }
  414. [123]=>
  415. array(1) {
  416. [456]=>
  417. array(1) {
  418. ["abc"]=>
  419. array(3) {
  420. [789]=>
  421. string(3) "def"
  422. ["012"]=>
  423. array(4) {
  424. [0]=>
  425. int(1)
  426. [1]=>
  427. int(2)
  428. [2]=>
  429. string(1) "5"
  430. [3]=>
  431. int(500)
  432. }
  433. ["ghi"]=>
  434. array(5) {
  435. [0]=>
  436. int(1)
  437. [1]=>
  438. int(2)
  439. [2]=>
  440. string(4) "five"
  441. [3]=>
  442. int(50)
  443. [4]=>
  444. string(5) "sixty"
  445. }
  446. }
  447. }
  448. }
  449. ["address"]=>
  450. string(19) "50 St. James Street"
  451. ["url"]=>
  452. string(20) "http://www.JSON.org/"
  453. ["comment"]=>
  454. string(13) "// /* <!-- --"
  455. ["# -- --> */"]=>
  456. string(1) " "
  457. [" s p a c e d "]=>
  458. array(7) {
  459. [0]=>
  460. int(1)
  461. [1]=>
  462. int(2)
  463. [2]=>
  464. int(3)
  465. [3]=>
  466. int(4)
  467. [4]=>
  468. int(5)
  469. [5]=>
  470. int(6)
  471. [6]=>
  472. int(7)
  473. }
  474. ["compact"]=>
  475. array(7) {
  476. [0]=>
  477. int(1)
  478. [1]=>
  479. int(2)
  480. [2]=>
  481. int(3)
  482. [3]=>
  483. int(4)
  484. [4]=>
  485. int(5)
  486. [5]=>
  487. int(6)
  488. [6]=>
  489. int(7)
  490. }
  491. ["jsontext"]=>
  492. string(49) "{"object with 1 member":["array with 1 element"]}"
  493. ["quotes"]=>
  494. string(27) "&#34; " %22 0x22 034 &#x22;"
  495. ["/\"쫾몾ꮘﳞ볚
  496. `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
  497. string(23) "A key can be any string"
  498. }
  499. [9]=>
  500. float(0.5)
  501. [10]=>
  502. float(98.6)
  503. [11]=>
  504. float(99.44)
  505. [12]=>
  506. int(1066)
  507. [13]=>
  508. string(7) "rosebud"
  509. }
  510. ENCODE: FROM OBJECT
  511. ["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"":0,"E no .":4000000000000,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":{},"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
  512. ENCODE: FROM ARRAY
  513. ["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"":0,"E no .":4000000000000,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":[],"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
  514. DECODE AGAIN: AS OBJECT
  515. array(14) {
  516. [0]=>
  517. string(23) "JSON Test Pattern pass1"
  518. [1]=>
  519. object(stdClass)#%d (1) {
  520. ["object with 1 member"]=>
  521. array(1) {
  522. [0]=>
  523. string(20) "array with 1 element"
  524. }
  525. }
  526. [2]=>
  527. object(stdClass)#%d (0) {
  528. }
  529. [3]=>
  530. array(0) {
  531. }
  532. [4]=>
  533. int(-42)
  534. [5]=>
  535. bool(true)
  536. [6]=>
  537. bool(false)
  538. [7]=>
  539. NULL
  540. [8]=>
  541. object(stdClass)#%d (36) {
  542. ["integer"]=>
  543. int(1234567890)
  544. ["real"]=>
  545. float(-9876.54321)
  546. ["e"]=>
  547. float(1.23456789E-13)
  548. ["E"]=>
  549. float(1.23456789E+34)
  550. [""]=>
  551. int(0)
  552. ["E no ."]=>
  553. int(4000000000000)
  554. ["zero"]=>
  555. int(0)
  556. ["one"]=>
  557. int(1)
  558. ["space"]=>
  559. string(1) " "
  560. ["quote"]=>
  561. string(1) """
  562. ["backslash"]=>
  563. string(1) "\"
  564. ["controls"]=>
  565. string(5) "
  566. "
  567. ["slash"]=>
  568. string(5) "/ & /"
  569. ["alpha"]=>
  570. string(25) "abcdefghijklmnopqrstuvwyz"
  571. ["ALPHA"]=>
  572. string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
  573. ["digit"]=>
  574. string(10) "0123456789"
  575. ["special"]=>
  576. string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
  577. ["hex"]=>
  578. string(17) "ģ䕧覫췯ꯍ"
  579. ["unicode"]=>
  580. string(18) "プレスキット"
  581. ["プレスキット"]=>
  582. string(18) "プレスキット"
  583. ["empty_string"]=>
  584. string(0) ""
  585. ["true"]=>
  586. bool(true)
  587. ["false"]=>
  588. bool(false)
  589. ["null"]=>
  590. NULL
  591. ["array"]=>
  592. array(0) {
  593. }
  594. ["object"]=>
  595. object(stdClass)#%d (0) {
  596. }
  597. ["123"]=>
  598. object(stdClass)#%d (1) {
  599. ["456"]=>
  600. object(stdClass)#%d (1) {
  601. ["abc"]=>
  602. object(stdClass)#%d (3) {
  603. ["789"]=>
  604. string(3) "def"
  605. ["012"]=>
  606. array(4) {
  607. [0]=>
  608. int(1)
  609. [1]=>
  610. int(2)
  611. [2]=>
  612. string(1) "5"
  613. [3]=>
  614. int(500)
  615. }
  616. ["ghi"]=>
  617. array(5) {
  618. [0]=>
  619. int(1)
  620. [1]=>
  621. int(2)
  622. [2]=>
  623. string(4) "five"
  624. [3]=>
  625. int(50)
  626. [4]=>
  627. string(5) "sixty"
  628. }
  629. }
  630. }
  631. }
  632. ["address"]=>
  633. string(19) "50 St. James Street"
  634. ["url"]=>
  635. string(20) "http://www.JSON.org/"
  636. ["comment"]=>
  637. string(13) "// /* <!-- --"
  638. ["# -- --> */"]=>
  639. string(1) " "
  640. [" s p a c e d "]=>
  641. array(7) {
  642. [0]=>
  643. int(1)
  644. [1]=>
  645. int(2)
  646. [2]=>
  647. int(3)
  648. [3]=>
  649. int(4)
  650. [4]=>
  651. int(5)
  652. [5]=>
  653. int(6)
  654. [6]=>
  655. int(7)
  656. }
  657. ["compact"]=>
  658. array(7) {
  659. [0]=>
  660. int(1)
  661. [1]=>
  662. int(2)
  663. [2]=>
  664. int(3)
  665. [3]=>
  666. int(4)
  667. [4]=>
  668. int(5)
  669. [5]=>
  670. int(6)
  671. [6]=>
  672. int(7)
  673. }
  674. ["jsontext"]=>
  675. string(49) "{"object with 1 member":["array with 1 element"]}"
  676. ["quotes"]=>
  677. string(27) "&#34; " %22 0x22 034 &#x22;"
  678. ["/\"쫾몾ꮘﳞ볚
  679. `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
  680. string(23) "A key can be any string"
  681. }
  682. [9]=>
  683. float(0.5)
  684. [10]=>
  685. float(98.6)
  686. [11]=>
  687. float(99.44)
  688. [12]=>
  689. int(1066)
  690. [13]=>
  691. string(7) "rosebud"
  692. }
  693. DECODE AGAIN: AS ARRAY
  694. array(14) {
  695. [0]=>
  696. string(23) "JSON Test Pattern pass1"
  697. [1]=>
  698. array(1) {
  699. ["object with 1 member"]=>
  700. array(1) {
  701. [0]=>
  702. string(20) "array with 1 element"
  703. }
  704. }
  705. [2]=>
  706. array(0) {
  707. }
  708. [3]=>
  709. array(0) {
  710. }
  711. [4]=>
  712. int(-42)
  713. [5]=>
  714. bool(true)
  715. [6]=>
  716. bool(false)
  717. [7]=>
  718. NULL
  719. [8]=>
  720. array(36) {
  721. ["integer"]=>
  722. int(1234567890)
  723. ["real"]=>
  724. float(-9876.54321)
  725. ["e"]=>
  726. float(1.23456789E-13)
  727. ["E"]=>
  728. float(1.23456789E+34)
  729. [""]=>
  730. int(0)
  731. ["E no ."]=>
  732. int(4000000000000)
  733. ["zero"]=>
  734. int(0)
  735. ["one"]=>
  736. int(1)
  737. ["space"]=>
  738. string(1) " "
  739. ["quote"]=>
  740. string(1) """
  741. ["backslash"]=>
  742. string(1) "\"
  743. ["controls"]=>
  744. string(5) "
  745. "
  746. ["slash"]=>
  747. string(5) "/ & /"
  748. ["alpha"]=>
  749. string(25) "abcdefghijklmnopqrstuvwyz"
  750. ["ALPHA"]=>
  751. string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
  752. ["digit"]=>
  753. string(10) "0123456789"
  754. ["special"]=>
  755. string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
  756. ["hex"]=>
  757. string(17) "ģ䕧覫췯ꯍ"
  758. ["unicode"]=>
  759. string(18) "プレスキット"
  760. ["プレスキット"]=>
  761. string(18) "プレスキット"
  762. ["empty_string"]=>
  763. string(0) ""
  764. ["true"]=>
  765. bool(true)
  766. ["false"]=>
  767. bool(false)
  768. ["null"]=>
  769. NULL
  770. ["array"]=>
  771. array(0) {
  772. }
  773. ["object"]=>
  774. array(0) {
  775. }
  776. [123]=>
  777. array(1) {
  778. [456]=>
  779. array(1) {
  780. ["abc"]=>
  781. array(3) {
  782. [789]=>
  783. string(3) "def"
  784. ["012"]=>
  785. array(4) {
  786. [0]=>
  787. int(1)
  788. [1]=>
  789. int(2)
  790. [2]=>
  791. string(1) "5"
  792. [3]=>
  793. int(500)
  794. }
  795. ["ghi"]=>
  796. array(5) {
  797. [0]=>
  798. int(1)
  799. [1]=>
  800. int(2)
  801. [2]=>
  802. string(4) "five"
  803. [3]=>
  804. int(50)
  805. [4]=>
  806. string(5) "sixty"
  807. }
  808. }
  809. }
  810. }
  811. ["address"]=>
  812. string(19) "50 St. James Street"
  813. ["url"]=>
  814. string(20) "http://www.JSON.org/"
  815. ["comment"]=>
  816. string(13) "// /* <!-- --"
  817. ["# -- --> */"]=>
  818. string(1) " "
  819. [" s p a c e d "]=>
  820. array(7) {
  821. [0]=>
  822. int(1)
  823. [1]=>
  824. int(2)
  825. [2]=>
  826. int(3)
  827. [3]=>
  828. int(4)
  829. [4]=>
  830. int(5)
  831. [5]=>
  832. int(6)
  833. [6]=>
  834. int(7)
  835. }
  836. ["compact"]=>
  837. array(7) {
  838. [0]=>
  839. int(1)
  840. [1]=>
  841. int(2)
  842. [2]=>
  843. int(3)
  844. [3]=>
  845. int(4)
  846. [4]=>
  847. int(5)
  848. [5]=>
  849. int(6)
  850. [6]=>
  851. int(7)
  852. }
  853. ["jsontext"]=>
  854. string(49) "{"object with 1 member":["array with 1 element"]}"
  855. ["quotes"]=>
  856. string(27) "&#34; " %22 0x22 034 &#x22;"
  857. ["/\"쫾몾ꮘﳞ볚
  858. `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
  859. string(23) "A key can be any string"
  860. }
  861. [9]=>
  862. float(0.5)
  863. [10]=>
  864. float(98.6)
  865. [11]=>
  866. float(99.44)
  867. [12]=>
  868. int(1066)
  869. [13]=>
  870. string(7) "rosebud"
  871. }