3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strict() { $backtrace = debug_backtrace(0, 2); if (false === $backtrace || count($backtrace) !== 1) { throw new \RuntimeException('strict() must be called from within a function'); } $expectedTypes = func_get_args(); print_r($backtrace); } function myargs($a, $b) { strict('string', 'int'); echo 'Hello'; } myargs('hello', 4);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jIqck
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'myargs'
          1        SEND_VAL                                                 'hello'
          2        SEND_VAL                                                 4
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function strict:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/jIqck
function name:  strict
number of ops:  21
compiled vars:  !0 = $backtrace, !1 = $expectedTypes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 2
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
    7     5        TYPE_CHECK                                    4  ~4      !0
          6      > JMPNZ_EX                                         ~4      ~4, ->10
          7    >   COUNT                                            ~5      !0
          8        IS_NOT_IDENTICAL                                 ~6      ~5, 1
          9        BOOL                                             ~4      ~6
         10    > > JMPZ                                                     ~4, ->15
    8    11    >   NEW                                              $7      'RuntimeException'
         12        SEND_VAL_EX                                              'strict%28%29+must+be+called+from+within+a+function'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $7
   11    15    >   FUNC_GET_ARGS                                    ~9      
         16        ASSIGN                                                   !1, ~9
   13    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
   14    20      > RETURN                                                   null

End of function strict

Function myargs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jIqck
function name:  myargs
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'strict'
          3        SEND_VAL                                                 'string'
          4        SEND_VAL                                                 'int'
          5        DO_FCALL                                      0          
   20     6        ECHO                                                     'Hello'
   21     7      > RETURN                                                   null

End of function myargs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.53 ms | 1403 KiB | 19 Q