3v4l.org

run code in 500+ PHP versions simultaneously
<?php $db= new class{ public function real_escape_string(string $str):string{return $str;} }; $db=new $db; //var_dump($db); $search='Samsung Galaxy A7 (2017) 32gb'; $split=preg_split('/\s+/u',$search); $query='SELECT * FROM tbl WHERE '; foreach($split as $str){ $query.='`name` LIKE \'%'.$db->real_escape_string($str).'%\' AND '; } $query=substr($query,0,-strlen(' AND ')); var_dump($query);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/30llU
function name:  (null)
number of ops:  32
compiled vars:  !0 = $db, !1 = $search, !2 = $split, !3 = $query, !4 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_ANON_CLASS                                   <unknown> 
          1        NEW                                                  $6      $5
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $6
    5     4        FETCH_CLASS                                       0  $9      !0
          5        NEW                                                  $10     $9
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $10
    7     8        ASSIGN                                                       !1, 'Samsung+Galaxy+A7+%282017%29+32gb'
    8     9        INIT_FCALL                                                   'preg_split'
         10        SEND_VAL                                                     '%2F%5Cs%2B%2Fu'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                             $14     
         13        ASSIGN                                                       !2, $14
    9    14        ASSIGN                                                       !3, 'SELECT+%2A+FROM+tbl+WHERE+'
   10    15      > FE_RESET_R                                           $17     !2, ->24
         16    > > FE_FETCH_R                                                   $17, !4, ->24
   11    17    >   INIT_METHOD_CALL                                             !0, 'real_escape_string'
         18        SEND_VAR_EX                                                  !4
         19        DO_FCALL                                          0  $18     
         20        CONCAT                                               ~19     '%60name%60+LIKE+%27%25', $18
         21        CONCAT                                               ~20     ~19, '%25%27+AND+'
         22        ASSIGN_OP                                         8          !3, ~20
   10    23      > JMP                                                          ->16
         24    >   FE_FREE                                                      $17
   13    25        FRAMELESS_ICALL_3                substr              ~22     !3, 0
         26        OP_DATA                                                      -5
         27        ASSIGN                                                       !3, ~22
   14    28        INIT_FCALL                                                   'var_dump'
         29        SEND_VAR                                                     !3
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Class class@anonymous:
Function real_escape_string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/30llU
function name:  real_escape_string
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        VERIFY_RETURN_TYPE                                           !0
          2      > RETURN                                                       !0
          3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function real_escape_string

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.07 ms | 2984 KiB | 15 Q