3v4l.org

run code in 500+ PHP versions simultaneously
<?php class HelloWorld { public function sayHello(): string { return 'Hello, World!'; } } $date = new HelloWorld(); $a = match (true) { $date instanceof HelloWorld => 1, default => false }; var_dump($a); function applyDiscount(int $tier, float $price): float { switch ($tier) { case 1: $price = $price * 0.9; break; case 2: $price = $price * 0.8; break; } return $price; } var_dump(applyDiscount(9, 100.0)); function statusLabel($code): string { return match ($code) { 1 => 'active', 2 => 'disabled', default => 'unknown', }; } var_dump(statusLabel('1'));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
filename:       /in/884UR
function name:  (null)
number of ops:  29
compiled vars:  !0 = $date, !1 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   NEW                                                  $2      'HelloWorld'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   14     3        INSTANCEOF                                           ~6      !0, 'HelloWorld'
          4        IS_IDENTICAL                                                 ~6, <true>
          5      > JMPNZ                                                        ~5, ->7
          6    > > JMP                                                          ->9
          7    >   QM_ASSIGN                                            ~7      1
          8      > JMP                                                          ->11
   15     9    >   QM_ASSIGN                                            ~7      <false>
         10      > JMP                                                          ->11
   13    11    >   ASSIGN                                                       !1, ~7
   18    12        INIT_FCALL                                                   'var_dump'
         13        SEND_VAR                                                     !1
         14        DO_ICALL                                                     
   29    15        INIT_FCALL                                                   'var_dump'
         16        INIT_FCALL                                                   'applydiscount'
         17        SEND_VAL                                                     9
         18        SEND_VAL                                                     100
         19        DO_FCALL                                          0  $10     
         20        SEND_VAR                                                     $10
         21        DO_ICALL                                                     
   39    22        INIT_FCALL                                                   'var_dump'
         23        INIT_FCALL                                                   'statuslabel'
         24        SEND_VAL                                                     '1'
         25        DO_FCALL                                          0  $12     
         26        SEND_VAR                                                     $12
         27        DO_ICALL                                                     
         28      > RETURN                                                       1

Function applydiscount:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
filename:       /in/884UR
function name:  applyDiscount
number of ops:  17
compiled vars:  !0 = $tier, !1 = $price
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   24     2        IS_EQUAL                                                     !0, 1
          3      > JMPNZ                                                        ~2, ->7
   25     4    >   IS_EQUAL                                                     !0, 2
          5      > JMPNZ                                                        ~2, ->10
          6    > > JMP                                                          ->13
   24     7    >   MUL                                                  ~3      !1, 0.9
          8        ASSIGN                                                       !1, ~3
          9      > JMP                                                          ->13
   25    10    >   MUL                                                  ~5      !1, 0.8
         11        ASSIGN                                                       !1, ~5
         12      > JMP                                                          ->13
   27    13    >   VERIFY_RETURN_TYPE                                           !1
         14      > RETURN                                                       !1
   28    15*       VERIFY_RETURN_TYPE                                           
         16*     > RETURN                                                       null

End of function applydiscount

Function statuslabel:
Finding entry points
Branch analysis from position: 0
3 jumps found. (Code = 195) Position 1 = 2, Position 2 = 4, Position 3 = 6
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
filename:       /in/884UR
function name:  statusLabel
number of ops:  12
compiled vars:  !0 = $code
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   RECV                                                 !0      
   33     1      > MATCH                                                        !0, [ 1:->2, 2:->4, ], ->6
   34     2    >   QM_ASSIGN                                            ~2      'active'
          3      > JMP                                                          ->8
   35     4    >   QM_ASSIGN                                            ~2      'disabled'
          5      > JMP                                                          ->8
   36     6    >   QM_ASSIGN                                            ~2      'unknown'
          7      > JMP                                                          ->8
          8    >   VERIFY_RETURN_TYPE                                           ~2
          9      > RETURN                                                       ~2
   38    10*       VERIFY_RETURN_TYPE                                           
         11*     > RETURN                                                       null

End of function statuslabel

Class HelloWorld:
Function sayhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/884UR
function name:  sayHello
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                       'Hello%2C+World%21'
    8     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function sayhello

End of class HelloWorld.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.48 ms | 803 KiB | 11 Q