3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Customer { public $score; public function __construct($score) { $this->score = $score; } } $customers = []; $customers[] = new Customer(13); $customers[] = new Customer(11); $customers[] = new Customer(14); $customers[] = new Customer(10); $customers[] = new Customer(12.5); usort($customers, function($a, $b) { return $b->score - $a->score; }); var_dump($customers);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BOdr3
function name:  (null)
number of ops:  35
compiled vars:  !0 = $customers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        NEW                                              $3      'Customer'
          2        SEND_VAL_EX                                              13
          3        DO_FCALL                                      0          
          4        ASSIGN_DIM                                               !0
          5        OP_DATA                                                  $3
   12     6        NEW                                              $6      'Customer'
          7        SEND_VAL_EX                                              11
          8        DO_FCALL                                      0          
          9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  $6
   13    11        NEW                                              $9      'Customer'
         12        SEND_VAL_EX                                              14
         13        DO_FCALL                                      0          
         14        ASSIGN_DIM                                               !0
         15        OP_DATA                                                  $9
   14    16        NEW                                              $12     'Customer'
         17        SEND_VAL_EX                                              10
         18        DO_FCALL                                      0          
         19        ASSIGN_DIM                                               !0
         20        OP_DATA                                                  $12
   15    21        NEW                                              $15     'Customer'
         22        SEND_VAL_EX                                              12.5
         23        DO_FCALL                                      0          
         24        ASSIGN_DIM                                               !0
         25        OP_DATA                                                  $15
   18    26        INIT_FCALL                                               'usort'
         27        SEND_REF                                                 !0
         28        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBOdr3%3A18%240'
   20    29        SEND_VAL                                                 ~17
         30        DO_ICALL                                                 
   23    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FBOdr3%3A18%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BOdr3
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        FETCH_OBJ_R                                      ~2      !1, 'score'
          3        FETCH_OBJ_R                                      ~3      !0, 'score'
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
   20     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBOdr3%3A18%240

Class Customer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BOdr3
function name:  __construct
number of ops:  4
compiled vars:  !0 = $score
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'score'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

End of class Customer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.76 ms | 1400 KiB | 17 Q