3v4l.org

run code in 300+ PHP versions simultaneously
<?php $old = 'james,john,mark,luke,'; $users = 'james,john,mark,luke,mary,david'; $expr = rtrim(preg_replace('/\,/', '|', $old), '|'); $newstr = preg_replace("/$expr/i", '', $users); echo trim($newstr, ',');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W3XKe
function name:  (null)
number of ops:  27
compiled vars:  !0 = $old, !1 = $users, !2 = $expr, !3 = $newstr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'james%2Cjohn%2Cmark%2Cluke%2C'
    3     1        ASSIGN                                                   !1, 'james%2Cjohn%2Cmark%2Cluke%2Cmary%2Cdavid'
    5     2        INIT_FCALL                                               'rtrim'
          3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%2F%5C%2C%2F'
          5        SEND_VAL                                                 '%7C'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        SEND_VAL                                                 '%7C'
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
    6    12        INIT_FCALL                                               'preg_replace'
         13        ROPE_INIT                                     3  ~10     '%2F'
         14        ROPE_ADD                                      1  ~10     ~10, !2
         15        ROPE_END                                      2  ~9      ~10, '%2Fi'
         16        SEND_VAL                                                 ~9
         17        SEND_VAL                                                 ''
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !3, $12
    7    21        INIT_FCALL                                               'trim'
         22        SEND_VAR                                                 !3
         23        SEND_VAL                                                 '%2C'
         24        DO_ICALL                                         $14     
         25        ECHO                                                     $14
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.4 ms | 1400 KiB | 19 Q