3v4l.org

run code in 300+ PHP versions simultaneously
<?php function escape_quote($data) { $clean = array(); foreach ($data as $key=>$val) { if (is_array($val)) { escape_quote($val); } $val = str_replace("'", "''", $val); $clean[$key] = $val; } return $clean; } $vars = array ( 'customer1' => array ( 'fname' => 'John', 'lname' => "D'oe" ), 'customer2' => array ( 'name' => array ( 'fname' => 'John', 'lname' => "D'oe" ), 'address' => '1234 street', 'phone' => '1234567899' ) ); $output = escape_quote($vars); print_r($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8lQLJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $vars, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, <array>
   41     1        INIT_FCALL                                               'escape_quote'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   42     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function escape_quote:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/8lQLJ
function name:  escape_quote
number of ops:  22
compiled vars:  !0 = $data, !1 = $clean, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, <array>
    8     2      > FE_RESET_R                                       $5      !0, ->19
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->19
          4    >   ASSIGN                                                   !3, ~6
   10     5        TYPE_CHECK                                  128          !2
          6      > JMPZ                                                     ~8, ->10
   12     7    >   INIT_FCALL_BY_NAME                                       'escape_quote'
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0          
   14    10    >   INIT_FCALL                                               'str_replace'
         11        SEND_VAL                                                 '%27'
         12        SEND_VAL                                                 '%27%27'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !2, $10
   15    16        ASSIGN_DIM                                               !1, !3
         17        OP_DATA                                                  !2
    8    18      > JMP                                                      ->3
         19    >   FE_FREE                                                  $5
   18    20      > RETURN                                                   !1
   19    21*     > RETURN                                                   null

End of function escape_quote

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.68 ms | 1399 KiB | 18 Q