3v4l.org

run code in 300+ PHP versions simultaneously
<?php function slashit(&$aray, $db_link) { foreach ($aray as $key => $value) if(is_array($value)) slashit($value, $link); else $aray[$key] = mysql_real_escape_string($value, $db_link); } // Test: $fruits = array ( "fruits" => array("a" => "or'ange", "b" => "ban'ana", "c" => "apple'"), "numbers" => array(1, 2, 3, 4, 5, 6), "holes" => array("fir'st", 5 => "sec'ond", "thir'd"), "odma" => "jugo'slavija" ); // You have to make link to the database or can use addslashes instead of mysql_real_escape_string and remove $link from function definition slashit($fruits, $dbLink); echo "<pre>"; print_r($fruits); echo "</pre>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E1CZR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $fruits, !1 = $dbLink
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'slashit'
          2        SEND_REF                                                 !0
          3        SEND_VAR                                                 !1
          4        DO_FCALL                                      0          
   21     5        ECHO                                                     '%3Cpre%3E'
          6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9        ECHO                                                     '%3C%2Fpre%3E'
         10      > RETURN                                                   1

Function slashit:
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 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/E1CZR
function name:  slashit
number of ops:  21
compiled vars:  !0 = $aray, !1 = $db_link, !2 = $value, !3 = $key, !4 = $link
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2      > FE_RESET_R                                       $5      !0, ->19
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->19
          4    >   ASSIGN                                                   !3, ~6
    6     5        TYPE_CHECK                                  128          !2
          6      > JMPZ                                                     ~8, ->12
          7    >   INIT_FCALL_BY_NAME                                       'slashit'
          8        SEND_VAR_EX                                              !2
          9        SEND_VAR_EX                                              !4
         10        DO_FCALL                                      0          
         11      > JMP                                                      ->18
    7    12    >   INIT_FCALL_BY_NAME                                       'mysql_real_escape_string'
         13        SEND_VAR_EX                                              !2
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0  $11     
         16        ASSIGN_DIM                                               !0, !3
         17        OP_DATA                                                  $11
    5    18    > > JMP                                                      ->3
         19    >   FE_FREE                                                  $5
    8    20      > RETURN                                                   null

End of function slashit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.55 ms | 1399 KiB | 16 Q