3v4l.org

run code in 300+ PHP versions simultaneously
<?php global $statement; $db = new PDO('sqlite:/tmp/tmp.db', 'test', 'test'); $statement = $db->prepare('select 1 where 1 = :a'); function wrapper(string $param, mixed $value, int $type = PDO::PARAM_STR, int $maxLength = null, mixed $driverOptions = null) { $statement = $GLOBALS['statement']; var_dump('wrapper: ', \func_get_args()); var_dump('wrapper slice-3: ', \array_slice(\func_get_args(), 3)); $statement->bindParam($param, $value, $type, ...\array_slice(\func_get_args(), 3)); } echo 'wrapper("a",2)', PHP_EOL; wrapper("a",2); echo 'wrapper("a",2,PDO::PARAM_INT)', PHP_EOL; wrapper("a",2,PDO::PARAM_INT); echo 'wrapper("a","foo",PDO::PARAM_INT)', PHP_EOL; wrapper("a","foo",PDO::PARAM_INT); echo 'wrapper("a","foo",PDO::PARAM_INT,3)', PHP_EOL; wrapper("a","foo",PDO::PARAM_INT,3); echo 'wrapper("a","foo",PDO::PARAM_INT,null)', PHP_EOL; wrapper("a","foo",PDO::PARAM_INT,null);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/biaIs
function name:  (null)
number of ops:  48
compiled vars:  !0 = $statement, !1 = $db
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   BIND_GLOBAL                                              !0, 'statement'
    4     1        NEW                                              $2      'PDO'
          2        SEND_VAL_EX                                              'sqlite%3A%2Ftmp%2Ftmp.db'
          3        SEND_VAL_EX                                              'test'
          4        SEND_VAL_EX                                              'test'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $2
    5     7        INIT_METHOD_CALL                                         !1, 'prepare'
          8        SEND_VAL_EX                                              'select+1+where+1+%3D+%3Aa'
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !0, $5
   16    11        ECHO                                                     'wrapper%28%22a%22%2C2%29'
         12        ECHO                                                     '%0A'
   17    13        INIT_FCALL                                               'wrapper'
         14        SEND_VAL                                                 'a'
         15        SEND_VAL                                                 2
         16        DO_FCALL                                      0          
   18    17        ECHO                                                     'wrapper%28%22a%22%2C2%2CPDO%3A%3APARAM_INT%29'
         18        ECHO                                                     '%0A'
   19    19        INIT_FCALL                                               'wrapper'
         20        SEND_VAL                                                 'a'
         21        SEND_VAL                                                 2
         22        SEND_VAL                                                 1
         23        DO_FCALL                                      0          
   20    24        ECHO                                                     'wrapper%28%22a%22%2C%22foo%22%2CPDO%3A%3APARAM_INT%29'
         25        ECHO                                                     '%0A'
   21    26        INIT_FCALL                                               'wrapper'
         27        SEND_VAL                                                 'a'
         28        SEND_VAL                                                 'foo'
         29        SEND_VAL                                                 1
         30        DO_FCALL                                      0          
   22    31        ECHO                                                     'wrapper%28%22a%22%2C%22foo%22%2CPDO%3A%3APARAM_INT%2C3%29'
         32        ECHO                                                     '%0A'
   23    33        INIT_FCALL                                               'wrapper'
         34        SEND_VAL                                                 'a'
         35        SEND_VAL                                                 'foo'
         36        SEND_VAL                                                 1
         37        SEND_VAL                                                 3
         38        DO_FCALL                                      0          
   24    39        ECHO                                                     'wrapper%28%22a%22%2C%22foo%22%2CPDO%3A%3APARAM_INT%2Cnull%29'
         40        ECHO                                                     '%0A'
   25    41        INIT_FCALL                                               'wrapper'
         42        SEND_VAL                                                 'a'
         43        SEND_VAL                                                 'foo'
         44        SEND_VAL                                                 1
         45        SEND_VAL                                                 null
         46        DO_FCALL                                      0          
         47      > RETURN                                                   1

Function wrapper:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/biaIs
function name:  wrapper
number of ops:  26
compiled vars:  !0 = $param, !1 = $value, !2 = $type, !3 = $maxLength, !4 = $driverOptions, !5 = $statement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <const ast>
          3        RECV_INIT                                        !3      null
          4        RECV_INIT                                        !4      null
    8     5        FETCH_R                      global              ~6      'statement'
          6        ASSIGN                                                   !5, ~6
   10     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAL                                                 'wrapper%3A+'
          9        FUNC_GET_ARGS                                    ~8      
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                                 
   12    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAL                                                 'wrapper+slice-3%3A+'
         14        FUNC_GET_ARGS                                    ~10     3
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                                 
   13    17        INIT_METHOD_CALL                                         !5, 'bindParam'
         18        SEND_VAR_EX                                              !0
         19        SEND_VAR_EX                                              !1
         20        SEND_VAR_EX                                              !2
         21        FUNC_GET_ARGS                                    ~12     3
         22        SEND_UNPACK                                              ~12
         23        CHECK_UNDEF_ARGS                                         
         24        DO_FCALL                                      1          
   14    25      > RETURN                                                   null

End of function wrapper

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.61 ms | 1017 KiB | 19 Q