3v4l.org

run code in 300+ PHP versions simultaneously
<?php function prepareKeywordsForDatabase($string) { $keywords = explode(',', $string); $keywords = array_map('trim', $keywords); $array = array(); foreach ($keywords as $k) { if ($k == '') { continue; } $k = preg_replace('#[\s]{1,}#', ' ', $k); $array[] = $k; } return implode('.', $array); } echo prepareKeywordsForDatabase('ciao, come , , , , va ?!! !!');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZuM52
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'preparekeywordsfordatabase'
          1        SEND_VAL                                                 'ciao%2C%0A%0Acome+%2C+%2C+%2C+%2C+va+%3F%21%21%0A%0A%21%21'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   24     4      > RETURN                                                   1

Function preparekeywordsfordatabase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 26
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/ZuM52
function name:  prepareKeywordsForDatabase
number of ops:  33
compiled vars:  !0 = $string, !1 = $keywords, !2 = $array, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        INIT_FCALL                                               'array_map'
          7        SEND_VAL                                                 'trim'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !1, $6
    6    11        ASSIGN                                                   !2, <array>
    7    12      > FE_RESET_R                                       $9      !1, ->26
         13    > > FE_FETCH_R                                               $9, !3, ->26
    8    14    >   IS_EQUAL                                                 !3, ''
         15      > JMPZ                                                     ~10, ->17
    9    16    > > JMP                                                      ->13
   12    17    >   INIT_FCALL                                               'preg_replace'
         18        SEND_VAL                                                 '%23%5B%5Cs%5D%7B1%2C%7D%23'
         19        SEND_VAL                                                 '+'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $11     
         22        ASSIGN                                                   !3, $11
   13    23        ASSIGN_DIM                                               !2
         24        OP_DATA                                                  !3
    7    25      > JMP                                                      ->13
         26    >   FE_FREE                                                  $9
   16    27        INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '.'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $14     
         31      > RETURN                                                   $14
   17    32*     > RETURN                                                   null

End of function preparekeywordsfordatabase

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.25 ms | 1394 KiB | 22 Q