3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = 'BCFSW|'; $arr = array('BF','BCF','BFS','BFW'); $str = str_split($str); Foreach($arr as $item){ $temp = str_split($item); $new[] = implode("",array_diff($str, $temp)) . implode("",array_intersect($temp, $str)); } var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 26
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/8RvL2
function name:  (null)
number of ops:  31
compiled vars:  !0 = $str, !1 = $arr, !2 = $item, !3 = $temp, !4 = $new
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'BCFSW%7C'
    5     1        ASSIGN                                                       !1, <array>
    7     2        INIT_FCALL                                                   'str_split'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $7      
          5        ASSIGN                                                       !0, $7
    8     6      > FE_RESET_R                                           $9      !1, ->26
          7    > > FE_FETCH_R                                                   $9, !2, ->26
    9     8    >   INIT_FCALL                                                   'str_split'
          9        SEND_VAR                                                     !2
         10        DO_ICALL                                             $10     
         11        ASSIGN                                                       !3, $10
   10    12        INIT_FCALL                                                   'array_diff'
         13        SEND_VAR                                                     !0
         14        SEND_VAR                                                     !3
         15        DO_ICALL                                             $13     
         16        FRAMELESS_ICALL_2                implode             ~14     '', $13
         17        INIT_FCALL                                                   'array_intersect'
         18        SEND_VAR                                                     !3
         19        SEND_VAR                                                     !0
         20        DO_ICALL                                             $15     
         21        FRAMELESS_ICALL_2                implode             ~16     '', $15
         22        CONCAT                                               ~17     ~14, ~16
         23        ASSIGN_DIM                                                   !4
         24        OP_DATA                                                      ~17
    8    25      > JMP                                                          ->7
         26    >   FE_FREE                                                      $9
   13    27        INIT_FCALL                                                   'var_dump'
         28        SEND_VAR                                                     !4
         29        DO_ICALL                                                     
         30      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.02 ms | 2568 KiB | 17 Q