3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iterations = 100; $json = <<<JSON { "status": "ok", "items": [ { "title": "Some valuable title", "descr": "Another valuable description, much longer", "url": "http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf", "bid": 0.1 }, { "title": "Some valuable title", "descr": "Another valuable description, much longer", "url": "http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf", "bid": 0.1 }, { "title": "Some valuable title", "descr": "Another valuable description, much longer", "url": "http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf", "bid": 0.1 }, { "title": "Some valuable title", "descr": "Another valuable description, much longer", "url": "http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf", "bid": 0.1 }, { "title": "Some valuable title", "descr": "Another valuable description, much longer", "url": "http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf", "bid": 0.1 } ] } JSON; $xml = <<<XML <?xml version='1.0'?> <response> <status>ok</status> <items> <item> <title>Some valuable title</title> <descr>Another valuable description, much longer</descr> <url> <![CDATA[http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf]]></url> <bid>0.1</bid> </item> <item> <title>Some valuable title</title> <descr>Another valuable description, much longer</descr> <url> <![CDATA[http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf]]></url> <bid>0.1</bid> </item> <item> <title>Some valuable title</title> <descr>Another valuable description, much longer</descr> <url> <![CDATA[http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf]]></url> <bid>0.1</bid> </item> <item> <title>Some valuable title</title> <descr>Another valuable description, much longer</descr> <url> <![CDATA[http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf]]></url> <bid>0.1</bid> </item> <item> <title>Some valuable title</title> <descr>Another valuable description, much longer</descr> <url> <![CDATA[http://alonglonglnog.com/?var=qp34rasjdnfkamdso;ilaksdnfa;sldjngaskdnfa;sdlkfjasd;lkfasdf]]></url> <bid>0.1</bid> </item> </items> </response> XML; $start = microtime(true); for ($i = 0; $i < $iterations; $i++) { $obj = json_encode($json); } printf("json, sec: %.5f\n", microtime(true) - $start); $start = microtime(true); for ($i = 0; $i < $iterations; $i++) { $xmlObj = simplexml_load_string($xml); } printf("xml, sec: %.5f\n", microtime(true) - $start);
Output for 7.2.0
json, sec: 0.00040 xml, sec: 0.00285
Output for 7.1.7
json, sec: 0.00050 xml, sec: 0.00211
Output for 7.1.6
json, sec: 0.00101 xml, sec: 0.00419
Output for 7.1.5
json, sec: 0.00104 xml, sec: 0.00489
Output for 7.1.0
json, sec: 0.00098 xml, sec: 0.00386
Output for 7.0.20
json, sec: 0.00041 xml, sec: 0.00218
Output for 7.0.14
json, sec: 0.00094 xml, sec: 0.00366
Output for 7.0.9
json, sec: 0.00042 xml, sec: 0.00217
Output for 7.0.8
json, sec: 0.00072 xml, sec: 0.00400
Output for 7.0.7
json, sec: 0.00053 xml, sec: 0.00296
Output for 7.0.6
json, sec: 0.00071 xml, sec: 0.00323
Output for 7.0.5
json, sec: 0.00068 xml, sec: 0.00356
Output for 7.0.4
json, sec: 0.00054 xml, sec: 0.00265
Output for 7.0.3
json, sec: 0.00073 xml, sec: 0.00325
Output for 7.0.2
json, sec: 0.00068 xml, sec: 0.00326
Output for 7.0.1
json, sec: 0.00070 xml, sec: 0.00310
Output for 7.0.0
json, sec: 0.00074 xml, sec: 0.00342
Output for 5.6.24
json, sec: 0.00142 xml, sec: 0.00360
Output for 5.6.23
json, sec: 0.00124 xml, sec: 0.00301
Output for 5.6.22
json, sec: 0.00126 xml, sec: 0.00254
Output for 5.6.21
json, sec: 0.00147 xml, sec: 0.00323
Output for 5.6.20
json, sec: 0.00111 xml, sec: 0.00264
Output for 5.6.19
json, sec: 0.00116 xml, sec: 0.00311
Output for 5.6.18
json, sec: 0.00133 xml, sec: 0.00283
Output for 5.6.17
json, sec: 0.00143 xml, sec: 0.00335
Output for 5.6.16
json, sec: 0.00146 xml, sec: 0.00316
Output for 5.6.15
json, sec: 0.00180 xml, sec: 0.00426
Output for 5.6.14
json, sec: 0.00143 xml, sec: 0.00372
Output for 5.6.13
json, sec: 0.00129 xml, sec: 0.00295
Output for 5.6.12
json, sec: 0.00114 xml, sec: 0.00311
Output for 5.6.11
json, sec: 0.00125 xml, sec: 0.00303
Output for 5.6.10
json, sec: 0.00158 xml, sec: 0.00355
Output for 5.6.9
json, sec: 0.00166 xml, sec: 0.00496
Output for 5.6.8
json, sec: 0.00165 xml, sec: 0.00357
Output for 5.6.7
json, sec: 0.00105 xml, sec: 0.00443
Output for 5.6.6
json, sec: 0.00127 xml, sec: 0.00226
Output for 5.6.5
json, sec: 0.00090 xml, sec: 0.00227
Output for 5.6.4
json, sec: 0.00092 xml, sec: 0.00222
Output for 5.6.3
json, sec: 0.00104 xml, sec: 0.00344
Output for 5.6.2
json, sec: 0.00090 xml, sec: 0.00219
Output for 5.6.1
json, sec: 0.00091 xml, sec: 0.00220
Output for 5.6.0
json, sec: 0.00098 xml, sec: 0.00240
Output for 5.5.38
json, sec: 0.00097 xml, sec: 0.00314
Output for 5.5.37
json, sec: 0.00163 xml, sec: 0.00358
Output for 5.5.36
json, sec: 0.00198 xml, sec: 0.00341
Output for 5.5.35
json, sec: 0.00136 xml, sec: 0.00314
Output for 5.5.34
json, sec: 0.00111 xml, sec: 0.00232
Output for 5.5.33
json, sec: 0.00106 xml, sec: 0.00253
Output for 5.5.32
json, sec: 0.00126 xml, sec: 0.00291
Output for 5.5.31
json, sec: 0.00146 xml, sec: 0.00357
Output for 5.5.30
json, sec: 0.00127 xml, sec: 0.00287
Output for 5.5.29
json, sec: 0.00123 xml, sec: 0.00276
Output for 5.5.28
json, sec: 0.00135 xml, sec: 0.00328
Output for 5.5.27
json, sec: 0.00151 xml, sec: 0.00295
Output for 5.5.26
json, sec: 0.00160 xml, sec: 0.00358
Output for 5.5.25
json, sec: 0.00135 xml, sec: 0.00304
Output for 5.5.24
json, sec: 0.00095 xml, sec: 0.00231
Output for 5.5.23
json, sec: 0.00141 xml, sec: 0.00322
Output for 5.5.22
json, sec: 0.00090 xml, sec: 0.00215
Output for 5.5.21
json, sec: 0.00095 xml, sec: 0.00218
Output for 5.5.20
json, sec: 0.00088 xml, sec: 0.00214
Output for 5.5.19
json, sec: 0.00092 xml, sec: 0.00220
Output for 5.5.18
json, sec: 0.00092 xml, sec: 0.00253
Output for 5.5.16
json, sec: 0.00082 xml, sec: 0.00194
Output for 5.5.15
json, sec: 0.00097 xml, sec: 0.00214
Output for 5.5.14
json, sec: 0.00077 xml, sec: 0.00187
Output for 5.5.13
json, sec: 0.00075 xml, sec: 0.00210
Output for 5.5.12
json, sec: 0.00076 xml, sec: 0.00187
Output for 5.5.11
json, sec: 0.00135 xml, sec: 0.00336
Output for 5.5.10
json, sec: 0.00088 xml, sec: 0.00243
Output for 5.5.9
json, sec: 0.00095 xml, sec: 0.00251
Output for 5.5.8
json, sec: 0.00093 xml, sec: 0.00224
Output for 5.5.7
json, sec: 0.00089 xml, sec: 0.00227
Output for 5.5.6
json, sec: 0.00098 xml, sec: 0.00244
Output for 5.5.5
json, sec: 0.00088 xml, sec: 0.00246
Output for 5.5.4
json, sec: 0.00101 xml, sec: 0.00245
Output for 5.5.3
json, sec: 0.00101 xml, sec: 0.00255
Output for 5.5.2
json, sec: 0.00133 xml, sec: 0.00313
Output for 5.5.1
json, sec: 0.00095 xml, sec: 0.00219
Output for 5.5.0
json, sec: 0.00102 xml, sec: 0.00242
Output for 5.4.45
json, sec: 0.00094 xml, sec: 0.00232
Output for 5.4.44
json, sec: 0.00141 xml, sec: 0.00344
Output for 5.4.43
json, sec: 0.00119 xml, sec: 0.00296
Output for 5.4.42
json, sec: 0.00135 xml, sec: 0.00423
Output for 5.4.41
json, sec: 0.00138 xml, sec: 0.00349
Output for 5.4.40
json, sec: 0.00094 xml, sec: 0.00220
Output for 5.4.39
json, sec: 0.00100 xml, sec: 0.00304
Output for 5.4.38
json, sec: 0.00134 xml, sec: 0.00327
Output for 5.4.27, 5.4.37
json, sec: 0.00091 xml, sec: 0.00223
Output for 5.4.36
json, sec: 0.00092 xml, sec: 0.00223
Output for 5.4.35
json, sec: 0.00096 xml, sec: 0.00222
Output for 5.4.34
json, sec: 0.00111 xml, sec: 0.00234
Output for 5.4.32
json, sec: 0.00087 xml, sec: 0.00207
Output for 5.4.31
json, sec: 0.00082 xml, sec: 0.00178
Output for 5.4.30
json, sec: 0.00090 xml, sec: 0.00223
Output for 5.4.29
json, sec: 0.00093 xml, sec: 0.00225
Output for 5.4.28
json, sec: 0.00073 xml, sec: 0.00178
Output for 5.4.26
json, sec: 0.00093 xml, sec: 0.00245
Output for 5.4.25
json, sec: 0.00118 xml, sec: 0.00282
Output for 5.4.24
json, sec: 0.00111 xml, sec: 0.00273
Output for 5.4.23
json, sec: 0.00092 xml, sec: 0.00237
Output for 5.4.22
json, sec: 0.00114 xml, sec: 0.00276
Output for 5.4.21
json, sec: 0.00110 xml, sec: 0.00274
Output for 5.4.20
json, sec: 0.00081 xml, sec: 0.00230
Output for 5.4.19
json, sec: 0.00087 xml, sec: 0.00258
Output for 5.4.18
json, sec: 0.00088 xml, sec: 0.00226
Output for 5.4.17
json, sec: 0.00084 xml, sec: 0.00261
Output for 5.4.16
json, sec: 0.00091 xml, sec: 0.00255
Output for 5.4.15
json, sec: 0.00088 xml, sec: 0.00215
Output for 5.4.14
json, sec: 0.00114 xml, sec: 0.00270
Output for 5.4.13
json, sec: 0.00170 xml, sec: 0.00383
Output for 5.4.12
json, sec: 0.00114 xml, sec: 0.00307
Output for 5.4.11
json, sec: 0.00147 xml, sec: 0.00523
Output for 5.4.10
json, sec: 0.00134 xml, sec: 0.00300
Output for 5.4.9
json, sec: 0.00135 xml, sec: 0.00337
Output for 5.4.8
json, sec: 0.00127 xml, sec: 0.00311
Output for 5.4.7
json, sec: 0.00138 xml, sec: 0.00320
Output for 5.4.6
json, sec: 0.00093 xml, sec: 0.00301
Output for 5.4.5
json, sec: 0.00118 xml, sec: 0.00295
Output for 5.4.4
json, sec: 0.00146 xml, sec: 0.00269
Output for 5.4.3
json, sec: 0.00133 xml, sec: 0.00303
Output for 5.4.2
json, sec: 0.00126 xml, sec: 0.00294
Output for 5.4.1
json, sec: 0.00129 xml, sec: 0.00294
Output for 5.4.0
json, sec: 0.00137 xml, sec: 0.00285
Output for 5.3.29
json, sec: 0.00084 xml, sec: 0.00227
Output for 5.3.28
json, sec: 0.00125 xml, sec: 0.00309
Output for 5.3.27
json, sec: 0.00083 xml, sec: 0.00223
Output for 5.3.26
json, sec: 0.00125 xml, sec: 0.00324
Output for 5.3.25
json, sec: 0.00085 xml, sec: 0.00219
Output for 5.3.24
json, sec: 0.00122 xml, sec: 0.00361
Output for 5.3.23
json, sec: 0.00133 xml, sec: 0.00291
Output for 5.3.22
json, sec: 0.00108 xml, sec: 0.00420
Output for 5.3.21
json, sec: 0.00089 xml, sec: 0.00304
Output for 5.3.20
json, sec: 0.00093 xml, sec: 0.00251
Output for 5.3.19
json, sec: 0.00111 xml, sec: 0.00249
Output for 5.3.18
json, sec: 0.00137 xml, sec: 0.00384
Output for 5.3.17
json, sec: 0.00135 xml, sec: 0.00389
Output for 5.3.16
json, sec: 0.00101 xml, sec: 0.00223
Output for 5.3.15
json, sec: 0.00129 xml, sec: 0.00349
Output for 5.3.14
json, sec: 0.00119 xml, sec: 0.00307
Output for 5.3.13
json, sec: 0.00123 xml, sec: 0.00270
Output for 5.3.12
json, sec: 0.00181 xml, sec: 0.00486
Output for 5.3.11
json, sec: 0.00132 xml, sec: 0.00329
Output for 5.3.10
json, sec: 0.00124 xml, sec: 0.00283
Output for 5.3.9
json, sec: 0.00123 xml, sec: 0.00320
Output for 5.3.8
json, sec: 0.00142 xml, sec: 0.00393
Output for 5.3.7
json, sec: 0.00142 xml, sec: 0.00317
Output for 5.3.6
json, sec: 0.00138 xml, sec: 0.00358
Output for 5.3.5
json, sec: 0.00114 xml, sec: 0.00303
Output for 5.3.4
json, sec: 0.00142 xml, sec: 0.00387
Output for 5.3.3
json, sec: 0.00135 xml, sec: 0.00295
Output for 5.3.2
json, sec: 0.00120 xml, sec: 0.00314
Output for 5.3.1
json, sec: 0.00118 xml, sec: 0.00299
Output for 5.3.0
json, sec: 0.00120 xml, sec: 0.00301
Output for 5.2.17
json, sec: 0.00146 xml, sec: 0.00391
Output for 5.2.16
json, sec: 0.00155 xml, sec: 0.00427
Output for 5.2.15
json, sec: 0.00131 xml, sec: 0.00390
Output for 5.2.14
json, sec: 0.00112 xml, sec: 0.00275
Output for 5.2.13
json, sec: 0.00148 xml, sec: 0.00379
Output for 5.2.12
json, sec: 0.00141 xml, sec: 0.00365
Output for 5.2.11
json, sec: 0.00100 xml, sec: 0.00261
Output for 5.2.10
json, sec: 0.00085 xml, sec: 0.00220
Output for 5.2.9
json, sec: 0.00145 xml, sec: 0.00397
Output for 5.2.8
json, sec: 0.00118 xml, sec: 0.00328
Output for 5.2.7
json, sec: 0.00124 xml, sec: 0.00374
Output for 5.2.6
json, sec: 0.00120 xml, sec: 0.00330
Output for 5.2.5
json, sec: 0.00108 xml, sec: 0.00230
Output for 5.2.4
json, sec: 0.00115 xml, sec: 0.00302
Output for 5.2.3
json, sec: 0.00125 xml, sec: 0.00334
Output for 5.2.2
json, sec: 0.00101 xml, sec: 0.00261
Output for 5.2.1
json, sec: 0.00099 xml, sec: 0.00269
Output for 5.2.0
json, sec: 0.00154 xml, sec: 0.00389
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/kWDKg on line 88
Process exited with code 255.
Output for 5.1.2
Fatal error: Call to undefined function json_encode() in /in/kWDKg on line 90
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/kWDKg on line 88
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/kWDKg on line 88
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: json_encode() in /in/kWDKg on line 90
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/kWDKg on line 88

preferences:
206.26 ms | 401 KiB | 213 Q