3v4l.org

run code in 500+ PHP versions simultaneously
<?php function extractWantedStuff($string) { $sections = explode('""', $string); foreach ($sections as $key => $section) { if ($key % 2 != 0) { $sections[$key] = str_replace(',', '', $section); } } return implode('""', $sections); } $fullstring = ',""Word1, Word2"" and another thing ,""Word3, Word4""'; echo extractWantedStuff($fullstring);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MaWLX
function name:  (null)
number of ops:  6
compiled vars:  !0 = $fullstring
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                       !0, '%2C%22%22Word1%2C+Word2%22%22+and+another+thing+%2C%22%22Word3%2C+Word4%22%22'
   16     1        INIT_FCALL                                                   'extractwantedstuff'
          2        SEND_VAR                                                     !0
          3        DO_FCALL                                          0  $2      
          4        ECHO                                                         $2
          5      > RETURN                                                       1

Function extractwantedstuff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/MaWLX
function name:  extractWantedStuff
number of ops:  21
compiled vars:  !0 = $string, !1 = $sections, !2 = $section, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '%22%22'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $4      
          5        ASSIGN                                                       !1, $4
    6     6      > FE_RESET_R                                           $6      !1, ->17
          7    > > FE_FETCH_R                                           ~7      $6, !2, ->17
          8    >   ASSIGN                                                       !3, ~7
    7     9        MOD                                                  ~9      !3, 2
         10        IS_NOT_EQUAL                                                 ~9, 0
         11      > JMPZ                                                         ~10, ->16
    8    12    >   FRAMELESS_ICALL_3                str_replace         ~12     '%2C', ''
         13        OP_DATA                                                      !2
         14        ASSIGN_DIM                                                   !1, !3
         15        OP_DATA                                                      ~12
    6    16    > > JMP                                                          ->7
         17    >   FE_FREE                                                      $6
   11    18        FRAMELESS_ICALL_2                implode             ~13     '%22%22', !1
         19      > RETURN                                                       ~13
   12    20*     > RETURN                                                       null

End of function extractwantedstuff

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.24 ms | 1890 KiB | 15 Q