3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [ "A - 1.0 - Title Page.PDF", "A - 2.2 - Enlarged Floor Plans", "A - 2.1.0 - Structural Details.PDF", "E - 1.0 - Electrical Title Page.PDF", "A - 1.2 - Floor Plan.PDF", "P - 1.0 - Plumbing Title Page2.PDF", "A - 2.1.1 - Structural Details.PDF", "C - 1.0 - Civil Title Page.PDF", "M - 1.0 - Mechanical Title Page.PDF", "ESC - 1.0 - Erosion Control Plan.PDF", "P - 1.0 - Plumbing Title Page.PDF", ]; $priorities = array_flip(['A', 'ESC', 'C', 'M', 'E', 'P']); usort($arr, function ($a, $b) use ($priorities) { [$categoryA, $versionA, $nameA] = explode(' - ', $a, 3); [$categoryB, $versionB, $nameB] = explode(' - ', $b, 3); return [$priorities[$categoryA], version_compare($versionB, $versionA), $nameA] <=> [$priorities[$categoryB], version_compare($versionA, $versionB), $nameB]; }); var_export($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/udVn3
function name:  (null)
number of ops:  15
compiled vars:  !0 = $arr, !1 = $priorities
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   17     1        INIT_FCALL                                                   'array_flip'
          2        SEND_VAL                                                     <array>
          3        DO_ICALL                                             $3      
          4        ASSIGN                                                       !1, $3
   19     5        INIT_FCALL                                                   'usort'
          6        SEND_REF                                                     !0
          7        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          8        BIND_LEXICAL                                                 ~5, !1
   26     9        SEND_VAL                                                     ~5
   19    10        DO_ICALL                                                     
   27    11        INIT_FCALL                                                   'var_export'
         12        SEND_VAR                                                     !0
         13        DO_ICALL                                                     
         14      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/udVn3
function name:  {closure:/in/udVn3:19}
number of ops:  46
compiled vars:  !0 = $a, !1 = $b, !2 = $priorities, !3 = $categoryA, !4 = $versionA, !5 = $nameA, !6 = $categoryB, !7 = $versionB, !8 = $nameB
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   20     3        INIT_FCALL                                                   'explode'
          4        SEND_VAL                                                     '+-+'
          5        SEND_VAR                                                     !0
          6        SEND_VAL                                                     3
          7        DO_ICALL                                             $9      
          8        FETCH_LIST_R                                         $10     $9, 0
          9        ASSIGN                                                       !3, $10
         10        FETCH_LIST_R                                         $12     $9, 1
         11        ASSIGN                                                       !4, $12
         12        FETCH_LIST_R                                         $14     $9, 2
         13        ASSIGN                                                       !5, $14
         14        FREE                                                         $9
   21    15        INIT_FCALL                                                   'explode'
         16        SEND_VAL                                                     '+-+'
         17        SEND_VAR                                                     !1
         18        SEND_VAL                                                     3
         19        DO_ICALL                                             $16     
         20        FETCH_LIST_R                                         $17     $16, 0
         21        ASSIGN                                                       !6, $17
         22        FETCH_LIST_R                                         $19     $16, 1
         23        ASSIGN                                                       !7, $19
         24        FETCH_LIST_R                                         $21     $16, 2
         25        ASSIGN                                                       !8, $21
         26        FREE                                                         $16
   23    27        FETCH_DIM_R                                          ~23     !2, !3
         28        INIT_ARRAY                                           ~24     ~23
         29        INIT_FCALL                                                   'version_compare'
         30        SEND_VAR                                                     !7
         31        SEND_VAR                                                     !4
         32        DO_ICALL                                             $25     
         33        ADD_ARRAY_ELEMENT                                    ~24     $25
         34        ADD_ARRAY_ELEMENT                                    ~24     !5
   25    35        FETCH_DIM_R                                          ~26     !2, !6
         36        INIT_ARRAY                                           ~27     ~26
         37        INIT_FCALL                                                   'version_compare'
         38        SEND_VAR                                                     !4
         39        SEND_VAR                                                     !7
         40        DO_ICALL                                             $28     
         41        ADD_ARRAY_ELEMENT                                    ~27     $28
         42        ADD_ARRAY_ELEMENT                                    ~27     !8
         43        SPACESHIP                                            ~29     ~24, ~27
         44      > RETURN                                                       ~29
   26    45*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.87 ms | 2217 KiB | 18 Q