3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $name; } $test1 = new Test(); $test1 -> name = "Футбол"; $test3 = new Test(); $test3 -> name = "Гандбол"; $test2 = new Test(); $test2 -> name = "Баскетбол"; $arr = array(); $arr[] = $test1; $arr[] = $test3; $arr[] = $test2; var_dump($arr); usort($arr, function ($a,$b) { $al = strtolower($a->name); $bl = strtolower($b->name); if($al[0] < $bl[0]) return -1; elseif($al[0] > $bl[0]) return 1; else return 0; }); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CtQHM
function name:  (null)
number of ops:  34
compiled vars:  !0 = $test1, !1 = $test3, !2 = $test2, !3 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $4      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    8     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  '%D0%A4%D1%83%D1%82%D0%B1%D0%BE%D0%BB'
   10     5        NEW                                              $8      'Test'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
   11     8        ASSIGN_OBJ                                               !1, 'name'
          9        OP_DATA                                                  '%D0%93%D0%B0%D0%BD%D0%B4%D0%B1%D0%BE%D0%BB'
   13    10        NEW                                              $12     'Test'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
   14    13        ASSIGN_OBJ                                               !2, 'name'
         14        OP_DATA                                                  '%D0%91%D0%B0%D1%81%D0%BA%D0%B5%D1%82%D0%B1%D0%BE%D0%BB'
   16    15        ASSIGN                                                   !3, <array>
   17    16        ASSIGN_DIM                                               !3
         17        OP_DATA                                                  !0
   18    18        ASSIGN_DIM                                               !3
         19        OP_DATA                                                  !1
   19    20        ASSIGN_DIM                                               !3
         21        OP_DATA                                                  !2
   20    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                                 
   22    25        INIT_FCALL                                               'usort'
         26        SEND_REF                                                 !3
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCtQHM%3A22%240'
   28    28        SEND_VAL                                                 ~21
         29        DO_ICALL                                                 
   30    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCtQHM%3A22%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CtQHM
function name:  {closure}
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $al, !3 = $bl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        INIT_FCALL                                               'strtolower'
          3        FETCH_OBJ_R                                      ~4      !0, 'name'
          4        SEND_VAL                                                 ~4
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   24     7        INIT_FCALL                                               'strtolower'
          8        FETCH_OBJ_R                                      ~7      !1, 'name'
          9        SEND_VAL                                                 ~7
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !3, $8
   25    12        FETCH_DIM_R                                      ~10     !2, 0
         13        FETCH_DIM_R                                      ~11     !3, 0
         14        IS_SMALLER                                               ~10, ~11
         15      > JMPZ                                                     ~12, ->18
         16    > > RETURN                                                   -1
         17*       JMP                                                      ->25
   26    18    >   FETCH_DIM_R                                      ~13     !2, 0
         19        FETCH_DIM_R                                      ~14     !3, 0
         20        IS_SMALLER                                               ~14, ~13
         21      > JMPZ                                                     ~15, ->24
         22    > > RETURN                                                   1
         23*       JMP                                                      ->25
   27    24    > > RETURN                                                   0
   28    25*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FCtQHM%3A22%240

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.64 ms | 1400 KiB | 19 Q