3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compareByX($a, $b) { return $a->x - $b->x; } // Ejemplo de array de objetos Foo $foos = [ new Foo(5), new Foo(3), new Foo(7), new Foo(1), ]; // Ordenamos el array por la propiedad x usort($foos, 'compareByX'); // Obtenemos el objeto con el valor mínimo de x $minFoo = $foos[0]; echo $minFoo->x; // Imprime 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gA4Uv
function name:  (null)
number of ops:  26
compiled vars:  !0 = $foos, !1 = $minFoo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $2      'Foo'
          1        SEND_VAL_EX                                              5
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~4      $2
   10     4        NEW                                              $5      'Foo'
          5        SEND_VAL_EX                                              3
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~4      $5
   11     8        NEW                                              $7      'Foo'
          9        SEND_VAL_EX                                              7
         10        DO_FCALL                                      0          
         11        ADD_ARRAY_ELEMENT                                ~4      $7
   12    12        NEW                                              $9      'Foo'
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0          
         15        ADD_ARRAY_ELEMENT                                ~4      $9
    8    16        ASSIGN                                                   !0, ~4
   16    17        INIT_FCALL                                               'usort'
         18        SEND_REF                                                 !0
         19        SEND_VAL                                                 'compareByX'
         20        DO_ICALL                                                 
   19    21        FETCH_DIM_R                                      ~13     !0, 0
         22        ASSIGN                                                   !1, ~13
   21    23        FETCH_OBJ_R                                      ~15     !1, 'x'
         24        ECHO                                                     ~15
         25      > RETURN                                                   1

Function comparebyx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gA4Uv
function name:  compareByX
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        FETCH_OBJ_R                                      ~2      !0, 'x'
          3        FETCH_OBJ_R                                      ~3      !1, 'x'
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
    5     6*     > RETURN                                                   null

End of function comparebyx

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.49 ms | 1396 KiB | 15 Q