3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { public function getTest($bar = null):? int { if($bar === 'test'){ return 1; } } } $test = new Foo(); var_dump($test->getTest()); var_dump($test->getTest('test'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o5ufU
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $1      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   15     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'getTest'
          5        DO_FCALL                                          0  $4      
          6        SEND_VAR                                                     $4
          7        DO_ICALL                                                     
   16     8        INIT_FCALL                                                   'var_dump'
          9        INIT_METHOD_CALL                                             !0, 'getTest'
         10        SEND_VAL_EX                                                  'test'
         11        DO_FCALL                                          0  $6      
         12        SEND_VAR                                                     $6
         13        DO_ICALL                                                     
         14      > RETURN                                                       1

Class Foo:
Function gettest:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o5ufU
function name:  getTest
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                            !0      null
    7     1        IS_IDENTICAL                                                 !0, 'test'
          2      > JMPZ                                                         ~1, ->4
    8     3    > > RETURN                                                       1
   10     4    >   VERIFY_RETURN_TYPE                                           
          5      > RETURN                                                       null

End of function gettest

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.56 ms | 477 KiB | 8 Q