3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DB { var $sql_query = 'update :table_foo set products_price = :products_price, products_price_ek = :products_price_ek'; function bindReplace($place_holder, $value) { $pos = strpos($this->sql_query, $place_holder); if ($pos !== false) { $length = strlen($place_holder); $character_after_place_holder = substr($this->sql_query, $pos+$length, 1); if (($character_after_place_holder === false) || ereg('[ ,)"]', $character_after_place_holder)) { $this->sql_query = substr_replace($this->sql_query, $value, $pos, $length); } } } } $obj = new DB; $obj->bindReplace(':products_price', '10.000'); echo $obj->sql_query; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vRHi2
function name:  (null)
number of ops:  10
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'DB'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_METHOD_CALL                                         !0, 'bindReplace'
          4        SEND_VAL_EX                                              '%3Aproducts_price'
          5        SEND_VAL_EX                                              '10.000'
          6        DO_FCALL                                      0          
   21     7        FETCH_OBJ_R                                      ~5      !0, 'sql_query'
          8        ECHO                                                     ~5
   22     9      > RETURN                                                   1

Class DB:
Function bindreplace:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 37
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 37
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 27
Branch analysis from position: 37
filename:       /in/vRHi2
function name:  bindReplace
number of ops:  38
compiled vars:  !0 = $place_holder, !1 = $value, !2 = $pos, !3 = $length, !4 = $character_after_place_holder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'strpos'
          3        FETCH_OBJ_R                                      ~5      'sql_query'
          4        SEND_VAL                                                 ~5
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
    8     8        TYPE_CHECK                                  1018          !2
          9      > JMPZ                                                     ~8, ->37
    9    10    >   STRLEN                                           ~9      !0
         11        ASSIGN                                                   !3, ~9
   10    12        INIT_FCALL                                               'substr'
         13        FETCH_OBJ_R                                      ~11     'sql_query'
         14        SEND_VAL                                                 ~11
         15        ADD                                              ~12     !2, !3
         16        SEND_VAL                                                 ~12
         17        SEND_VAL                                                 1
         18        DO_ICALL                                         $13     
         19        ASSIGN                                                   !4, $13
   12    20        TYPE_CHECK                                    4  ~15     !4
         21      > JMPNZ_EX                                         ~15     ~15, ->27
         22    >   INIT_FCALL_BY_NAME                                       'ereg'
         23        SEND_VAL_EX                                              '%5B+%2C%29%22%5D'
         24        SEND_VAR_EX                                              !4
         25        DO_FCALL                                      0  $16     
         26        BOOL                                             ~15     $16
         27    > > JMPZ                                                     ~15, ->37
   13    28    >   INIT_FCALL                                               'substr_replace'
         29        FETCH_OBJ_R                                      ~18     'sql_query'
         30        SEND_VAL                                                 ~18
         31        SEND_VAR                                                 !1
         32        SEND_VAR                                                 !2
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                         $19     
         35        ASSIGN_OBJ                                               'sql_query'
         36        OP_DATA                                                  $19
   16    37    > > RETURN                                                   null

End of function bindreplace

End of class DB.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.98 ms | 1400 KiB | 19 Q