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

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

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