3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four' ); $comma_separated = implode(", ", $arr); echo preg_replace('/\,([^,]+)$/', ' and $1', $comma_separated);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aNOeD
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arr, !1 = $comma_separated
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%2C+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    8     6        INIT_FCALL                                               'preg_replace'
          7        SEND_VAL                                                 '%2F%5C%2C%28%5B%5E%2C%5D%2B%29%24%2F'
          8        SEND_VAL                                                 '+and+%241'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $5      
         11        ECHO                                                     $5
         12      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.22 ms | 1005 KiB | 16 Q