3v4l.org

run code in 500+ PHP versions simultaneously
<?php $txt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam.'; $needles = str_word_count(strtolower($txt),1); foreach($needles as $needle){ echo "($needle) => ",preg_replace('~\b'.$needle.'\b\S*\K(?:\s\S+){0,2}~i','',$txt),"\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/jHr5R
function name:  (null)
number of ops:  24
compiled vars:  !0 = $txt, !1 = $needles, !2 = $needle
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 'Lorem+ipsum+dolor+sit+amet%2C+consetetur+sadipscing+elitr%2C+sed+diam.'
    3     1        INIT_FCALL                                                   'str_word_count'
          2        INIT_FCALL                                                   'strtolower'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $4      
          5        SEND_VAR                                                     $4
          6        SEND_VAL                                                     1
          7        DO_ICALL                                             $5      
          8        ASSIGN                                                       !1, $5
    4     9      > FE_RESET_R                                           $7      !1, ->22
         10    > > FE_FETCH_R                                                   $7, !2, ->22
    5    11    >   ROPE_INIT                                         3  ~9      '%28'
         12        ROPE_ADD                                          1  ~9      ~9, !2
         13        ROPE_END                                          2  ~8      ~9, '%29+%3D%3E+'
         14        ECHO                                                         ~8
         15        CONCAT                                               ~11     '%7E%5Cb', !2
         16        CONCAT                                               ~12     ~11, '%5Cb%5CS%2A%5CK%28%3F%3A%5Cs%5CS%2B%29%7B0%2C2%7D%7Ei'
         17        FRAMELESS_ICALL_3                preg_replace        ~13     ~12, ''
         18        OP_DATA                                                      !0
         19        ECHO                                                         ~13
         20        ECHO                                                         '%0A'
    4    21      > JMP                                                          ->10
         22    >   FE_FREE                                                      $7
    6    23      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.16 ms | 2157 KiB | 15 Q