3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { protected $val; public function __construct($val) { $this->$val = $val; } public function getVal() { return $this->val; } } $arr = array( 'one' => new test(3), 'two' => new test(2), 'three' => new test(1) ); uasort($arr, function (test $a, test $b) { if ($a->getVal() == $b->getVal()) { return 0; } return ($a->getVal() < $b->val()) ? -1 : 1; }); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZ4g2
function name:  (null)
number of ops:  22
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'test'
          1        SEND_VAL_EX                                              3
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~3      $1, 'one'
   17     4        NEW                                              $4      'test'
          5        SEND_VAL_EX                                              2
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~3      $4, 'two'
   18     8        NEW                                              $6      'test'
          9        SEND_VAL_EX                                              1
         10        DO_FCALL                                      0          
         11        ADD_ARRAY_ELEMENT                                ~3      $6, 'three'
   15    12        ASSIGN                                                   !0, ~3
   21    13        INIT_FCALL                                               'uasort'
         14        SEND_REF                                                 !0
         15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqZ4g2%3A21%240'
   27    16        SEND_VAL                                                 ~9
         17        DO_ICALL                                                 
   29    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FqZ4g2%3A21%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZ4g2
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        INIT_METHOD_CALL                                         !0, 'getVal'
          3        DO_FCALL                                      0  $2      
          4        INIT_METHOD_CALL                                         !1, 'getVal'
          5        DO_FCALL                                      0  $3      
          6        IS_EQUAL                                                 $2, $3
          7      > JMPZ                                                     ~4, ->9
   23     8    > > RETURN                                                   0
   26     9    >   INIT_METHOD_CALL                                         !0, 'getVal'
         10        DO_FCALL                                      0  $5      
         11        INIT_METHOD_CALL                                         !1, 'val'
         12        DO_FCALL                                      0  $6      
         13        IS_SMALLER                                               $5, $6
         14      > JMPZ                                                     ~7, ->17
         15    >   QM_ASSIGN                                        ~8      -1
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~8      1
         18    > > RETURN                                                   ~8
   27    19*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqZ4g2%3A21%240

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

End of function __construct

Function getval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZ4g2
function name:  getVal
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'val'
          1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function getval

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.31 ms | 1392 KiB | 17 Q