3v4l.org

run code in 300+ PHP versions simultaneously
<?php function key_compare_func($key1, $key2) { var_dump($key1, $key2, $key1 == $key2, $key1 > $key2); if ($key1 == $key2) return 0; else if ($key1 > $key2) return 1; else return -1; } $a=new stdClass; $a->{"0"}=1; $a->n=2; echo "key\n"; var_dump(array_diff_key((array)$a, [0])); echo "ukey\n"; var_dump(array_diff_ukey((array)$a, [0], 'key_compare_func'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k6UaW
function name:  (null)
number of ops:  27
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        ASSIGN_OBJ                                               !0, '0'
          4        OP_DATA                                                  1
   16     5        ASSIGN_OBJ                                               !0, 'n'
          6        OP_DATA                                                  2
   17     7        ECHO                                                     'key%0A'
   18     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'array_diff_key'
         10        CAST                                          7  ~6      !0
         11        SEND_VAL                                                 ~6
         12        SEND_VAL                                                 <array>
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
   19    16        ECHO                                                     'ukey%0A'
   20    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'array_diff_ukey'
         19        CAST                                          7  ~9      !0
         20        SEND_VAL                                                 ~9
         21        SEND_VAL                                                 <array>
         22        SEND_VAL                                                 'key_compare_func'
         23        DO_ICALL                                         $10     
         24        SEND_VAR                                                 $10
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Function key_compare_func:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k6UaW
function name:  key_compare_func
number of ops:  20
compiled vars:  !0 = $key1, !1 = $key2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        IS_EQUAL                                         ~2      !0, !1
          6        SEND_VAL                                                 ~2
          7        IS_SMALLER                                       ~3      !1, !0
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                                 
    6    10        IS_EQUAL                                                 !0, !1
         11      > JMPZ                                                     ~5, ->14
    7    12    > > RETURN                                                   0
         13*       JMP                                                      ->19
    8    14    >   IS_SMALLER                                               !1, !0
         15      > JMPZ                                                     ~6, ->18
    9    16    > > RETURN                                                   1
         17*       JMP                                                      ->19
   11    18    > > RETURN                                                   -1
   12    19*     > RETURN                                                   null

End of function key_compare_func

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.42 ms | 1405 KiB | 19 Q