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(53), 'two' => new test(200), 'three' => new test(100) ); uasort($arr, function (test $a, test $b) { echo 'comparing '.$a->getVal().' with '.$b->getVal(); 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/0944q
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                                              53
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~3      $1, 'one'
   17     4        NEW                                              $4      'test'
          5        SEND_VAL_EX                                              200
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~3      $4, 'two'
   18     8        NEW                                              $6      'test'
          9        SEND_VAL_EX                                              100
         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%2F0944q%3A21%240'
   29    16        SEND_VAL                                                 ~9
         17        DO_ICALL                                                 
   31    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F0944q%3A21%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0944q
function name:  {closure}
number of ops:  28
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        CONCAT                                           ~3      'comparing+', $2
          5        CONCAT                                           ~4      ~3, '+with+'
          6        INIT_METHOD_CALL                                         !1, 'getVal'
          7        DO_FCALL                                      0  $5      
          8        CONCAT                                           ~6      ~4, $5
          9        ECHO                                                     ~6
   24    10        INIT_METHOD_CALL                                         !0, 'getVal'
         11        DO_FCALL                                      0  $7      
         12        INIT_METHOD_CALL                                         !1, 'getVal'
         13        DO_FCALL                                      0  $8      
         14        IS_EQUAL                                                 $7, $8
         15      > JMPZ                                                     ~9, ->17
   25    16    > > RETURN                                                   0
   28    17    >   INIT_METHOD_CALL                                         !0, 'getVal'
         18        DO_FCALL                                      0  $10     
         19        INIT_METHOD_CALL                                         !1, 'val'
         20        DO_FCALL                                      0  $11     
         21        IS_SMALLER                                               $10, $11
         22      > JMPZ                                                     ~12, ->25
         23    >   QM_ASSIGN                                        ~13     -1
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~13     1
         26    > > RETURN                                                   ~13
   29    27*     > RETURN                                                   null

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

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0944q
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                                               'val'
          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/0944q
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:
151.87 ms | 1392 KiB | 17 Q