3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("4","6","2","ololo"); $time = microtime(true); $i=0; while($i < 50000) { $i++; json_encode($arr); } $time1 = microtime(true) - $time; $time = microtime(true); $i=0; while($i < 50000) { $i++; serialize($arr); } $time2 = microtime(true) - $time; echo '1 took ' . number_format($time1, 3) . "\n"; echo '2 took ' . number_format($time2, 3) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 24
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 24
Branch analysis from position: 30
Branch analysis from position: 24
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/1VWCn
function name:  (null)
number of ops:  50
compiled vars:  !0 = $arr, !1 = $time, !2 = $i, !3 = $time1, !4 = $time2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    6     5        ASSIGN                                                   !2, 0
    7     6      > JMP                                                      ->11
    9     7    >   PRE_INC                                                  !2
   10     8        INIT_FCALL                                               'json_encode'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
    7    11    >   IS_SMALLER                                               !2, 50000
         12      > JMPNZ                                                    ~11, ->7
   12    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $12     
         16        SUB                                              ~13     $12, !1
         17        ASSIGN                                                   !3, ~13
   14    18        INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $15     
         21        ASSIGN                                                   !1, $15
   15    22        ASSIGN                                                   !2, 0
   16    23      > JMP                                                      ->28
   18    24    >   PRE_INC                                                  !2
   19    25        INIT_FCALL                                               'serialize'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
   16    28    >   IS_SMALLER                                               !2, 50000
         29      > JMPNZ                                                    ~20, ->24
   21    30    >   INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $21     
         33        SUB                                              ~22     $21, !1
         34        ASSIGN                                                   !4, ~22
   23    35        INIT_FCALL                                               'number_format'
         36        SEND_VAR                                                 !3
         37        SEND_VAL                                                 3
         38        DO_ICALL                                         $24     
         39        CONCAT                                           ~25     '1+took+', $24
         40        CONCAT                                           ~26     ~25, '%0A'
         41        ECHO                                                     ~26
   24    42        INIT_FCALL                                               'number_format'
         43        SEND_VAR                                                 !4
         44        SEND_VAL                                                 3
         45        DO_ICALL                                         $27     
         46        CONCAT                                           ~28     '2+took+', $27
         47        CONCAT                                           ~29     ~28, '%0A'
         48        ECHO                                                     ~29
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.67 ms | 1400 KiB | 21 Q