3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check($function, ...$args) { try { $function(...$args); echo "okay $function\n"; } catch (ArgumentCountError $e) { echo "fail {$e->getMessage()}\n"; } } check("class_exists", "stdClass", false, 123); check("count", [], COUNT_NORMAL, 123); check("base64_encode", "string", 123); check("file_get_contents", __FILE__, false, null, 0, null, 123); check("mb_strlen", "string", "ASCII", 123); check("strlen", "string", 123);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H0bmY
function name:  (null)
number of ops:  38
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'check'
          1        SEND_VAL                                                 'class_exists'
          2        SEND_VAL                                                 'stdClass'
          3        SEND_VAL                                                 <false>
          4        SEND_VAL                                                 123
          5        DO_FCALL                                      0          
   13     6        INIT_FCALL                                               'check'
          7        SEND_VAL                                                 'count'
          8        SEND_VAL                                                 <array>
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 123
         11        DO_FCALL                                      0          
   14    12        INIT_FCALL                                               'check'
         13        SEND_VAL                                                 'base64_encode'
         14        SEND_VAL                                                 'string'
         15        SEND_VAL                                                 123
         16        DO_FCALL                                      0          
   15    17        INIT_FCALL                                               'check'
         18        SEND_VAL                                                 'file_get_contents'
         19        SEND_VAL                                                 '%2Fin%2FH0bmY'
         20        SEND_VAL                                                 <false>
         21        SEND_VAL                                                 null
         22        SEND_VAL                                                 0
         23        SEND_VAL                                                 null
         24        SEND_VAL                                                 123
         25        DO_FCALL                                      0          
   16    26        INIT_FCALL                                               'check'
         27        SEND_VAL                                                 'mb_strlen'
         28        SEND_VAL                                                 'string'
         29        SEND_VAL                                                 'ASCII'
         30        SEND_VAL                                                 123
         31        DO_FCALL                                      0          
   17    32        INIT_FCALL                                               'check'
         33        SEND_VAL                                                 'strlen'
         34        SEND_VAL                                                 'string'
         35        SEND_VAL                                                 123
         36        DO_FCALL                                      0          
         37      > RETURN                                                   1

Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 11
Branch analysis from position: 11
2 jumps found. (Code = 107) Position 1 = 12, Position 2 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H0bmY
function name:  check
number of ops:  19
compiled vars:  !0 = $function, !1 = $args, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
    5     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_UNPACK                                              !1
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1          
    6     6        ROPE_INIT                                     3  ~5      'okay++'
          7        ROPE_ADD                                      1  ~5      ~5, !0
          8        ROPE_END                                      2  ~4      ~5, '%0A'
          9        ECHO                                                     ~4
         10      > JMP                                                      ->18
    7    11  E > > CATCH                                       last         'ArgumentCountError'
    8    12    >   ROPE_INIT                                     3  ~9      'fail++'
         13        INIT_METHOD_CALL                                         !2, 'getMessage'
         14        DO_FCALL                                      0  $7      
         15        ROPE_ADD                                      1  ~9      ~9, $7
         16        ROPE_END                                      2  ~8      ~9, '%0A'
         17        ECHO                                                     ~8
   10    18    > > RETURN                                                   null

End of function check

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.2 ms | 1432 KiB | 19 Q