3v4l.org

run code in 300+ PHP versions simultaneously
<?php // pole hráčov vytiahnuté z údajov zo servera $players = [ [ 'id'=>1, 'wonid' =>'s1', ], [ 'id'=>2, 'wonid' => 's2', ], [ 'id'=>3, 'wonid' => 's3', ], [ 'id'=>4, 'wonid' => 's4', ], [ 'id'=>5, 'wonid' => 's5', ], [ 'id'=>6, 'wonid' => 's6', ], ]; // administrátori $user_id = ['s2', 's3', 's6']; usort($players, function($left, $right) use($user_id) { if(in_array($left['wonid'], $user_id)) { if(in_array($right['wonid'], $user_id)) return 0; // both admins return 1; // left is admin } return -1; // right is admin }); print_r($players); // ...?
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlBQF
function name:  (null)
number of ops:  12
compiled vars:  !0 = $players, !1 = $user_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   33     1        ASSIGN                                                   !1, <array>
   35     2        INIT_FCALL                                               'usort'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAlBQF%3A35%240'
          5        BIND_LEXICAL                                             ~4, !1
   42     6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   44     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   46    11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAlBQF%3A35%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlBQF
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $left, !1 = $right, !2 = $user_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   36     3        INIT_FCALL                                               'in_array'
          4        FETCH_DIM_R                                      ~3      !0, 'wonid'
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $4      
          8      > JMPZ                                                     $4, ->17
   37     9    >   INIT_FCALL                                               'in_array'
         10        FETCH_DIM_R                                      ~5      !1, 'wonid'
         11        SEND_VAL                                                 ~5
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $6      
         14      > JMPZ                                                     $6, ->16
   38    15    > > RETURN                                                   0
   39    16    > > RETURN                                                   1
   41    17    > > RETURN                                                   -1
   42    18*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAlBQF%3A35%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.91 ms | 1396 KiB | 19 Q