3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = str_repeat('[', 5_000_000) . '1' . str_repeat(']', 5_000_000); echo 'Input length: ', number_format(strlen($input) / 1024 / 1024, 3, ',', '.') . ' MiB', PHP_EOL; echo 'Memory before: ', number_format(memory_get_peak_usage(true) / 1024 / 1024, 3, ',', '.') . ' MiB', PHP_EOL; $output = json_decode($input); echo 'Memory after: ', number_format(memory_get_peak_usage(true) / 1024 / 1024, 3, ',', '.') . ' MiB', PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I5rp4
function name:  (null)
number of ops:  59
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'str_repeat'
          1        SEND_VAL                                                 '%5B'
          2        SEND_VAL                                                 5000000
          3        DO_ICALL                                         $2      
          4        CONCAT                                           ~3      $2, '1'
          5        INIT_FCALL                                               'str_repeat'
          6        SEND_VAL                                                 '%5D'
          7        SEND_VAL                                                 5000000
          8        DO_ICALL                                         $4      
          9        CONCAT                                           ~5      ~3, $4
         10        ASSIGN                                                   !0, ~5
    4    11        ECHO                                                     'Input+length%3A+'
         12        INIT_FCALL                                               'number_format'
         13        STRLEN                                           ~7      !0
         14        DIV                                              ~8      ~7, 1024
         15        DIV                                              ~9      ~8, 1024
         16        SEND_VAL                                                 ~9
         17        SEND_VAL                                                 3
         18        SEND_VAL                                                 '%2C'
         19        SEND_VAL                                                 '.'
         20        DO_ICALL                                         $10     
         21        CONCAT                                           ~11     $10, '+MiB'
         22        ECHO                                                     ~11
         23        ECHO                                                     '%0A'
    5    24        ECHO                                                     'Memory+before%3A+'
         25        INIT_FCALL                                               'number_format'
         26        INIT_FCALL                                               'memory_get_peak_usage'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $12     
         29        DIV                                              ~13     $12, 1024
         30        DIV                                              ~14     ~13, 1024
         31        SEND_VAL                                                 ~14
         32        SEND_VAL                                                 3
         33        SEND_VAL                                                 '%2C'
         34        SEND_VAL                                                 '.'
         35        DO_ICALL                                         $15     
         36        CONCAT                                           ~16     $15, '+MiB'
         37        ECHO                                                     ~16
         38        ECHO                                                     '%0A'
    6    39        INIT_FCALL                                               'json_decode'
         40        SEND_VAR                                                 !0
         41        DO_ICALL                                         $17     
         42        ASSIGN                                                   !1, $17
    7    43        ECHO                                                     'Memory+after%3A+'
         44        INIT_FCALL                                               'number_format'
         45        INIT_FCALL                                               'memory_get_peak_usage'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $19     
         48        DIV                                              ~20     $19, 1024
         49        DIV                                              ~21     ~20, 1024
         50        SEND_VAL                                                 ~21
         51        SEND_VAL                                                 3
         52        SEND_VAL                                                 '%2C'
         53        SEND_VAL                                                 '.'
         54        DO_ICALL                                         $22     
         55        CONCAT                                           ~23     $22, '+MiB'
         56        ECHO                                                     ~23
         57        ECHO                                                     '%0A'
    8    58      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.03 ms | 1021 KiB | 17 Q