3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array ( 0 => array ( 'php' => 5.3, ), 1 => array ( 'php' => 5.3, ), 2 => array ( 'php' => 5.3, ), ); $t = microtime(true); for ($i = 0; $i < 1000000; $i++) { $a = array_map('serialize', $a); $a = array_unique($a); $a = array_map('unserialize', $a); } echo 'serialize'; var_dump($a); echo microtime(true) - $t."\n"; $t = microtime(true); for ($i = 0; $i < 1000000; $i++) { $a = array_map('json_encode', $a); $a = array_unique($a); $a = array_map(function($v) { return json_decode($v, true);}, $a); } echo 'json'; var_dump($a); echo microtime(true) - $t."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 40
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 40
Branch analysis from position: 58
Branch analysis from position: 40
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
Branch analysis from position: 7
filename:       /in/djIlG
function name:  (null)
number of ops:  69
compiled vars:  !0 = $a, !1 = $t, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   18     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->22
   19     7    >   INIT_FCALL                                               'array_map'
          8        SEND_VAL                                                 'serialize'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !0, $7
   20    12        INIT_FCALL                                               'array_unique'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !0, $9
   21    16        INIT_FCALL                                               'array_map'
         17        SEND_VAL                                                 'unserialize'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $11     
         20        ASSIGN                                                   !0, $11
   18    21        PRE_INC                                                  !2
         22    >   IS_SMALLER                                               !2, 1000000
         23      > JMPNZ                                                    ~14, ->7
   23    24    >   ECHO                                                     'serialize'
   24    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
   25    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $16     
         31        SUB                                              ~17     $16, !1
         32        CONCAT                                           ~18     ~17, '%0A'
         33        ECHO                                                     ~18
   27    34        INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $19     
         37        ASSIGN                                                   !1, $19
   28    38        ASSIGN                                                   !2, 0
         39      > JMP                                                      ->56
   29    40    >   INIT_FCALL                                               'array_map'
         41        SEND_VAL                                                 'json_encode'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                         $22     
         44        ASSIGN                                                   !0, $22
   30    45        INIT_FCALL                                               'array_unique'
         46        SEND_VAR                                                 !0
         47        DO_ICALL                                         $24     
         48        ASSIGN                                                   !0, $24
   31    49        INIT_FCALL                                               'array_map'
         50        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FdjIlG%3A31%240'
         51        SEND_VAL                                                 ~26
         52        SEND_VAR                                                 !0
         53        DO_ICALL                                         $27     
         54        ASSIGN                                                   !0, $27
   28    55        PRE_INC                                                  !2
         56    >   IS_SMALLER                                               !2, 1000000
         57      > JMPNZ                                                    ~30, ->40
   33    58    >   ECHO                                                     'json'
   34    59        INIT_FCALL                                               'var_dump'
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                                 
   35    62        INIT_FCALL                                               'microtime'
         63        SEND_VAL                                                 <true>
         64        DO_ICALL                                         $32     
         65        SUB                                              ~33     $32, !1
         66        CONCAT                                           ~34     ~33, '%0A'
         67        ECHO                                                     ~34
         68      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FdjIlG%3A31%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/djIlG
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FdjIlG%3A31%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.62 ms | 1400 KiB | 23 Q