3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface MoneyFormatter { public function format($value, $decimals = 0, $decimalPoint = '.', $thousandsSeparator = ','); } class GDPMoneyFormatter implements MoneyFormatter { public function format($value, $decimals = 0, $decimalPoint = '.', $thousandsSeparator = ',') { return sprintf('$%s', number_format($number, $decimals, $decPoint, $thousandsSep)); } } class WeirdMoneyFormatter implements MoneyFormatter { public function format($value, $decimals = 0, $decimalPoint = '.', $thousandsSeparator = ',') { return sprintf('$%s', number_format($number, $decimals, $decPoint, $thousandsSep)); } } abstract class MoneyFormatterExtension implements MoneyFormatterExtensionInterface { protected $formatter; public function __construct(MoneyFormatter $formatter) { $this->formatter = $formatter; } } class WeirdFormatterExtension extends MoneyFormatterExtension { public function __construct(WeirdMoneyFormatter $formatter) { parent::__construct($formatter); } } class GDPFormatterExtension extends MoneyFormatterExtension { public function __construct(GDPMoneyFormatter $formatter) { parent::__construct($formatter); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'gdpmoneyformatter'
   16     1        DECLARE_CLASS                                            'weirdmoneyformatter'
   25     2        DECLARE_CLASS                                            'moneyformatterextension'
   35     3        DECLARE_CLASS                                            'weirdformatterextension', 'moneyformatterextension'
   43     4        DECLARE_CLASS                                            'gdpformatterextension', 'moneyformatterextension'
   49     5      > RETURN                                                   1

Class MoneyFormatter:
Function format:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  format
number of ops:  5
compiled vars:  !0 = $value, !1 = $decimals, !2 = $decimalPoint, !3 = $thousandsSeparator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
          2        RECV_INIT                                        !2      '.'
          3        RECV_INIT                                        !3      '%2C'
          4      > RETURN                                                   null

End of function format

End of class MoneyFormatter.

Class GDPMoneyFormatter:
Function format:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  format
number of ops:  16
compiled vars:  !0 = $value, !1 = $decimals, !2 = $decimalPoint, !3 = $thousandsSeparator, !4 = $number, !5 = $decPoint, !6 = $thousandsSep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
          2        RECV_INIT                                        !2      '.'
          3        RECV_INIT                                        !3      '%2C'
   12     4        INIT_FCALL                                               'sprintf'
          5        SEND_VAL                                                 '%24%25s'
          6        INIT_FCALL                                               'number_format'
          7        SEND_VAR                                                 !4
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !5
         10        SEND_VAR                                                 !6
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14      > RETURN                                                   $8
   13    15*     > RETURN                                                   null

End of function format

End of class GDPMoneyFormatter.

Class WeirdMoneyFormatter:
Function format:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  format
number of ops:  16
compiled vars:  !0 = $value, !1 = $decimals, !2 = $decimalPoint, !3 = $thousandsSeparator, !4 = $number, !5 = $decPoint, !6 = $thousandsSep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
          2        RECV_INIT                                        !2      '.'
          3        RECV_INIT                                        !3      '%2C'
   20     4        INIT_FCALL                                               'sprintf'
          5        SEND_VAL                                                 '%24%25s'
          6        INIT_FCALL                                               'number_format'
          7        SEND_VAR                                                 !4
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !5
         10        SEND_VAR                                                 !6
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14      > RETURN                                                   $8
   21    15*     > RETURN                                                   null

End of function format

End of class WeirdMoneyFormatter.

Class MoneyFormatterExtension:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  __construct
number of ops:  4
compiled vars:  !0 = $formatter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   31     1        ASSIGN_OBJ                                               'formatter'
          2        OP_DATA                                                  !0
   32     3      > RETURN                                                   null

End of function __construct

End of class MoneyFormatterExtension.

Class WeirdFormatterExtension:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  __construct
number of ops:  5
compiled vars:  !0 = $formatter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
   39     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   40     4      > RETURN                                                   null

End of function __construct

End of class WeirdFormatterExtension.

Class GDPFormatterExtension:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RNjVc
function name:  __construct
number of ops:  5
compiled vars:  !0 = $formatter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   RECV                                             !0      
   47     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   48     4      > RETURN                                                   null

End of function __construct

End of class GDPFormatterExtension.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.45 ms | 1396 KiB | 17 Q