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));
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/gkRlL
function name:  (null)
number of ops:  23
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                                                     
         22      > 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/gkRlL
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

Class HelloWorld:
Function sayhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gkRlL
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:
150.82 ms | 797 KiB | 10 Q