3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['ref' => 'Q1'], ['ref' => 'C6'], ['ref' => 'C13'], ['ref' => 'S3'], ['ref' => 'Q11'], 8 => ['ref' => 'S7'], 9 => ['ref' => 'C4'], ]; $map = array_flip( ['S', 'Q', 'D', 'C', 'P', 'E'] ); foreach ($array as $keys[] => ['ref' => $v]) { sscanf($v, '%1s%d', $letter, $integers[]); $priorities[] = $map[$letter]; } array_multisort( $priorities, $integers, $array ); var_export(array_combine($keys, $array));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/U8IHd
function name:  (null)
number of ops:  37
compiled vars:  !0 = $array, !1 = $map, !2 = $v, !3 = $keys, !4 = $letter, !5 = $integers, !6 = $priorities
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'array_flip'
   14     2        SEND_VAL                                                 <array>
   13     3        DO_ICALL                                         $8      
          4        ASSIGN                                                   !1, $8
   17     5      > FE_RESET_R                                       $10     !0, ->23
          6    > > FE_FETCH_R                                       ~14     $10, $11, ->23
          7    >   FETCH_LIST_R                                     $12     $11, 'ref'
          8        ASSIGN                                                   !2, $12
          9        FREE                                                     $11
         10        ASSIGN_DIM                                               !3
         11        OP_DATA                                                  ~14
   18    12        INIT_FCALL                                               'sscanf'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 '%251s%25d'
         15        SEND_REF                                                 !4
         16        FETCH_DIM_W                                      $16     !5
         17        SEND_REF                                                 $16
         18        DO_ICALL                                                 
   19    19        FETCH_DIM_R                                      ~19     !1, !4
         20        ASSIGN_DIM                                               !6
         21        OP_DATA                                                  ~19
   17    22      > JMP                                                      ->6
         23    >   FE_FREE                                                  $10
   21    24        INIT_FCALL                                               'array_multisort'
   22    25        SEND_REF                                                 !6
   23    26        SEND_REF                                                 !5
   24    27        SEND_REF                                                 !0
   21    28        DO_ICALL                                                 
   26    29        INIT_FCALL                                               'var_export'
         30        INIT_FCALL                                               'array_combine'
         31        SEND_VAR                                                 !3
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $21     
         34        SEND_VAR                                                 $21
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.02 ms | 1015 KiB | 18 Q