3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cleanWord( &$word ){ $word = trim($word, "'\".!<>{}()-/\*&^%$#@+~ "); } // list of comments $arr_str = [ " this!! is the first &test message./", "*Second ^message this (is) ", "'another\ **message*** !\"}& it is. also the favorite one (message)." ]; // To join array's items $str = implode(" ", $arr_str); // To chop the string based on the space $words = explode(" ",$str); // To remove redundant character(s) array_walk($words, 'cleanWord'); // To remove empty array elements $words = array_filter($words); print_r($words);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XlcBr
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arr_str, !1 = $str, !2 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   18     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '+'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !2, $6
   21    11        INIT_FCALL                                               'array_walk'
         12        SEND_REF                                                 !2
         13        SEND_VAL                                                 'cleanWord'
         14        DO_ICALL                                                 
   24    15        INIT_FCALL                                               'array_filter'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   26    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function cleanword:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XlcBr
function name:  cleanWord
number of ops:  7
compiled vars:  !0 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%27%22.%21%3C%3E%7B%7D%28%29-%2F%5C%2A%26%5E%25%24%23%40%2B%7E+'
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
    5     6      > RETURN                                                   null

End of function cleanword

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.11 ms | 1017 KiB | 19 Q