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; } echo memory_get_usage() . "\n" . print_r($documents) . "\n"; if ($documents[$a] == $documents[$b]) { return 0; } return $documents[$a] < $documents[$b] ? -1 : 1; }); print_r($xmls);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C1tFh
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%2FC1tFh%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%2FC1tFh%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 = 26, Position 2 = 27
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/C1tFh
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    >   INIT_FCALL                                               'memory_get_usage'
         14        DO_ICALL                                         $9      
         15        CONCAT                                           ~10     $9, '%0A'
         16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $11     
         19        CONCAT                                           ~12     ~10, $11
         20        CONCAT                                           ~13     ~12, '%0A'
         21        ECHO                                                     ~13
   19    22        FETCH_DIM_R                                      ~14     !2, !0
         23        FETCH_DIM_R                                      ~15     !2, !1
         24        IS_EQUAL                                                 ~14, ~15
         25      > JMPZ                                                     ~16, ->27
   20    26    > > RETURN                                                   0
   22    27    >   FETCH_DIM_R                                      ~17     !2, !0
         28        FETCH_DIM_R                                      ~18     !2, !1
         29        IS_SMALLER                                               ~17, ~18
         30      > JMPZ                                                     ~19, ->33
         31    >   QM_ASSIGN                                        ~20     -1
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~20     1
         34    > > RETURN                                                   ~20
   23    35*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.01 ms | 1404 KiB | 20 Q