3v4l.org

run code in 500+ PHP versions simultaneously
<?php class NumberRank { public readonly int $power; public readonly int $number; public function __construct(int $power, int $number) { $this->power = $power; $this->number = $number; } } class RankedNumber { public readonly array $ranks; public function __construct(int $number) { $power = 0; $ranks = []; while ($number > 0) { $rankNumber = $number % 1000; $number = (int) floor($number / 1000); $power += 3; $ranks[$power] = new NumberRank($power, $rankNumber); } $this->ranks = $ranks; } } class Dictionary {} interface NumberToTextSpelling { public function spell(RankedNumber $number, Dictionary $dictionary): string; } class NumberToRussianTextSpelling implements NumberToTextSpelling { public function spell(RankedNumber $number, Dictionary $dictionary): string { // actual translation return ''; } } var_dump(new RankedNumber(11012013));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sBOk1
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   38     0  E >   DECLARE_CLASS                                                'numbertorussiantextspelling'
   45     1        INIT_FCALL                                                   'var_dump'
          2        NEW                                                  $0      'RankedNumber'
          3        SEND_VAL_EX                                                  11012013
          4        DO_FCALL                                          0          
          5        SEND_VAR                                                     $0
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

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

End of function __construct

End of class NumberRank.

Class RankedNumber:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 4
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 4
Branch analysis from position: 21
Branch analysis from position: 4
filename:       /in/sBOk1
function name:  __construct
number of ops:  24
compiled vars:  !0 = $number, !1 = $power, !2 = $ranks, !3 = $rankNumber
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   17     1        ASSIGN                                                       !1, 0
   18     2        ASSIGN                                                       !2, <array>
   20     3      > JMP                                                          ->19
   21     4    >   MOD                                                  ~6      !0, 1000
          5        ASSIGN                                                       !3, ~6
   22     6        INIT_FCALL                                                   'floor'
          7        DIV                                                  ~8      !0, 1000
          8        SEND_VAL                                                     ~8
          9        DO_ICALL                                             $9      
         10        CAST                                              4  ~10     $9
         11        ASSIGN                                                       !0, ~10
   23    12        ASSIGN_OP                                         1          !1, 3
   25    13        NEW                                                  $14     'NumberRank'
         14        SEND_VAR_EX                                                  !1
         15        SEND_VAR_EX                                                  !3
         16        DO_FCALL                                          0          
         17        ASSIGN_DIM                                                   !2, !1
         18        OP_DATA                                                      $14
   20    19    >   IS_SMALLER                                                   0, !0
         20      > JMPNZ                                                        ~16, ->4
   28    21    >   ASSIGN_OBJ                                                   'ranks'
         22        OP_DATA                                                      !2
   29    23      > RETURN                                                       null

End of function __construct

End of class RankedNumber.

Class Dictionary: [no user functions]
Class NumberToTextSpelling:
Function spell:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sBOk1
function name:  spell
number of ops:  4
compiled vars:  !0 = $number, !1 = $dictionary
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        VERIFY_RETURN_TYPE                                           
          3      > RETURN                                                       null

End of function spell

End of class NumberToTextSpelling.

Class NumberToRussianTextSpelling:
Function spell:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sBOk1
function name:  spell
number of ops:  5
compiled vars:  !0 = $number, !1 = $dictionary
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   39     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   41     2      > RETURN                                                       ''
   42     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function spell

End of class NumberToRussianTextSpelling.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.53 ms | 1672 KiB | 15 Q