3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'aaa, bbb, ccc, ddd, eee, fff'; $n = 3; var_export( preg_replace("/(?:[^,]*\K,){{$n}}.*/s", '', $string) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aVo8h
function name:  (null)
number of ops:  14
compiled vars:  !0 = $string, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'aaa%2C+bbb%2C+ccc%2C+ddd%2C+eee%2C+fff'
    4     1        ASSIGN                                                   !1, 3
    5     2        INIT_FCALL                                               'var_export'
    6     3        INIT_FCALL                                               'preg_replace'
          4        ROPE_INIT                                     3  ~5      '%2F%28%3F%3A%5B%5E%2C%5D%2A%5CK%2C%29%7B'
          5        ROPE_ADD                                      1  ~5      ~5, !1
          6        ROPE_END                                      2  ~4      ~5, '%7D.%2A%2Fs'
          7        SEND_VAL                                                 ~4
          8        SEND_VAL                                                 ''
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
    5    12        DO_ICALL                                                 
    7    13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.76 ms | 997 KiB | 15 Q