3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = [ [ "name" => "Marcos", "roles" => [ "admin" => "2023-11-16T10:23:45Z", "reader" => "2023-11-16T10:24:23Z" ] ], [ "name" => "Roberto", "roles" => [ "admin" => "2023-11-16T10:23:45Z", ] ], [ "name" => "Jaime", "roles" => [ "admin" => "2023-11-16T10:23:45Z", "writer" => "2023-11-16T10:24:23Z" ] ], [ "name" => "Xabier", "roles" => [ "admin" => "2023-11-16T10:23:45Z", "writer" => "2023-11-16T10:24:23Z", "reader" => "2023-11-16T10:24:23Z" ] ] ]; foreach($users as &$u){ ksort($u['roles']); } usort($users, fn($a, $b) => strcmp( implode("|", array_keys($a['roles'])), implode("|", array_keys($b['roles'])) ) ); print_r($users);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/sRrvS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $users, !1 = $u
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   34     1      > FE_RESET_RW                                      $3      !0, ->8
          2    > > FE_FETCH_RW                                              $3, !1, ->8
   35     3    >   INIT_FCALL                                               'ksort'
          4        FETCH_DIM_W                                      $4      !1, 'roles'
          5        SEND_REF                                                 $4
          6        DO_ICALL                                                 
   34     7      > JMP                                                      ->2
          8    >   FE_FREE                                                  $3
   38     9        INIT_FCALL                                               'usort'
         10        SEND_REF                                                 !0
         11        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   42    12        SEND_VAL                                                 ~6
   38    13        DO_ICALL                                                 
   44    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > 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/sRrvS
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL                                               'strcmp'
   39     3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%7C'
          5        INIT_FCALL                                               'array_keys'
          6        FETCH_DIM_R                                      ~2      !0, 'roles'
          7        SEND_VAL                                                 ~2
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                         $4      
         11        SEND_VAR                                                 $4
   40    12        INIT_FCALL                                               'implode'
         13        SEND_VAL                                                 '%7C'
         14        INIT_FCALL                                               'array_keys'
         15        FETCH_DIM_R                                      ~5      !1, 'roles'
         16        SEND_VAL                                                 ~5
         17        DO_ICALL                                         $6      
         18        SEND_VAR                                                 $6
         19        DO_ICALL                                         $7      
         20        SEND_VAR                                                 $7
   38    21        DO_ICALL                                         $8      
   40    22      > RETURN                                                   $8
   42    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.12 ms | 1021 KiB | 19 Q