3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'item1|item2|item 3||item 4|||yyyy-mm-dd'; $array = explode('|', $str); $array = array_filter($array); $last = array_pop($array); echo trim(implode (', ', $array)).' '.$last;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W0kPn
function name:  (null)
number of ops:  25
compiled vars:  !0 = $str, !1 = $array, !2 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'item1%7Citem2%7Citem+3%7C%7Citem+4%7C%7C%7Cyyyy-mm-dd'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%7C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    6     6        INIT_FCALL                                               'array_filter'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !1, $6
    8    10        INIT_FCALL                                               'array_pop'
         11        SEND_REF                                                 !1
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
   10    14        INIT_FCALL                                               'trim'
         15        INIT_FCALL                                               'implode'
         16        SEND_VAL                                                 '%2C+'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                         $11     
         21        CONCAT                                           ~12     $11, '+'
         22        CONCAT                                           ~13     ~12, !2
         23        ECHO                                                     ~13
   11    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.48 ms | 1004 KiB | 18 Q