3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SqlitePlatform { public static function udfSqrt($value) { return sqrt($value); } } $userDefinedFunctions = [ 'sqrt' => ['callback' => [SqlitePlatform::class, 'udfSqrt'], 'numArgs' => 1], ]; $dsn = "sqlite::memory:"; try { $pdo = new PDO($dsn); foreach ($userDefinedFunctions as $fn => $data) { $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']); } \var_dump($pdo); } catch (PDOException $e) { \var_dump($e); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Found catch point at position: 24
Branch analysis from position: 24
2 jumps found. (Code = 107) Position 1 = 25, Position 2 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QrqpV
function name:  (null)
number of ops:  29
compiled vars:  !0 = $userDefinedFunctions, !1 = $dsn, !2 = $pdo, !3 = $data, !4 = $fn, !5 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, 'sqlite%3A%3Amemory%3A'
   17     2        NEW                                              $8      'PDO'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $8
   18     6      > FE_RESET_R                                       $11     !0, ->19
          7    > > FE_FETCH_R                                       ~12     $11, !3, ->19
          8    >   ASSIGN                                                   !4, ~12
   19     9        INIT_METHOD_CALL                                         !2, 'sqliteCreateFunction'
         10        SEND_VAR_EX                                              !4
         11        CHECK_FUNC_ARG                                           
         12        FETCH_DIM_FUNC_ARG                               $14     !3, 'callback'
         13        SEND_FUNC_ARG                                            $14
         14        CHECK_FUNC_ARG                                           
         15        FETCH_DIM_FUNC_ARG                               $15     !3, 'numArgs'
         16        SEND_FUNC_ARG                                            $15
         17        DO_FCALL                                      0          
   18    18      > JMP                                                      ->7
         19    >   FE_FREE                                                  $11
   21    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
         23      > JMP                                                      ->28
   23    24  E > > CATCH                                       last         'PDOException'
   24    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                                 
   25    28    > > RETURN                                                   1

Class SqlitePlatform:
Function udfsqrt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QrqpV
function name:  udfSqrt
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'sqrt'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    8     5*     > RETURN                                                   null

End of function udfsqrt

End of class SqlitePlatform.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.89 ms | 1449 KiB | 15 Q