3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmls = [6, 3, 2, 5, 4, 1]; echo memory_get_usage() . "\n\n"; usort($xmls, function($a, $b) { static $documents = array(); if (!isset($documents[$a])) { $documents[$a] = true; } if (!isset($documents[$b])) { $documents[$b] = true; } if ($documents[$a] == $documents[$b]) { return 0; } return $documents[$a] < $documents[$b] ? -1 : 1; echo memory_get_usage() . "\n" . print_r($documents) . "\n"; }); print_r($xmls);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M5MLv
function name:  (null)
number of ops:  14
compiled vars:  !0 = $xmls
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'memory_get_usage'
          2        DO_ICALL                                         $2      
          3        CONCAT                                           ~3      $2, '%0A%0A'
          4        ECHO                                                     ~3
    7     5        INIT_FCALL                                               'usort'
          6        SEND_REF                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FM5MLv%3A7%240'
   23     8        SEND_VAL                                                 ~4
          9        DO_ICALL                                                 
   25    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FM5MLv%3A7%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/M5MLv
function name:  {closure}
number of ops:  36
compiled vars:  !0 = $a, !1 = $b, !2 = $documents
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        BIND_STATIC                                              !2
   10     3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !2, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->8
   11     6    >   ASSIGN_DIM                                               !2, !0
          7        OP_DATA                                                  <true>
   13     8    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !2, !1
          9        BOOL_NOT                                         ~7      ~6
         10      > JMPZ                                                     ~7, ->13
   14    11    >   ASSIGN_DIM                                               !2, !1
         12        OP_DATA                                                  <true>
   17    13    >   FETCH_DIM_R                                      ~9      !2, !0
         14        FETCH_DIM_R                                      ~10     !2, !1
         15        IS_EQUAL                                                 ~9, ~10
         16      > JMPZ                                                     ~11, ->18
   18    17    > > RETURN                                                   0
   20    18    >   FETCH_DIM_R                                      ~12     !2, !0
         19        FETCH_DIM_R                                      ~13     !2, !1
         20        IS_SMALLER                                               ~12, ~13
         21      > JMPZ                                                     ~14, ->24
         22    >   QM_ASSIGN                                        ~15     -1
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~15     1
         25    > > RETURN                                                   ~15
   22    26*       INIT_FCALL                                               'memory_get_usage'
         27*       DO_ICALL                                         $16     
         28*       CONCAT                                           ~17     $16, '%0A'
         29*       INIT_FCALL                                               'print_r'
         30*       SEND_VAR                                                 !2
         31*       DO_ICALL                                         $18     
         32*       CONCAT                                           ~19     ~17, $18
         33*       CONCAT                                           ~20     ~19, '%0A'
         34*       ECHO                                                     ~20
   23    35*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FM5MLv%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.3 ms | 1392 KiB | 19 Q