3v4l.org

run code in 300+ PHP versions simultaneously
<?php $row['item']='item1|item2|item 3||item 4|||yyyy-mm-dd'; $row['item']=preg_replace(['~\|+(?=[^|]+$)~','~\|+~'],[' ',', '],$row['item']); echo $row['item'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WAESg
function name:  (null)
number of ops:  13
compiled vars:  !0 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN_DIM                                               !0, 'item'
          1        OP_DATA                                                  'item1%7Citem2%7Citem+3%7C%7Citem+4%7C%7C%7Cyyyy-mm-dd'
    4     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 <array>
          5        FETCH_DIM_R                                      ~3      !0, 'item'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8        ASSIGN_DIM                                               !0, 'item'
          9        OP_DATA                                                  $4
    6    10        FETCH_DIM_R                                      ~5      !0, 'item'
         11        ECHO                                                     ~5
         12      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.94 ms | 998 KiB | 14 Q