3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'a,b,c,d,e'; echo substr_count( $str, ','); echo "\n"; echo implode( ',', explode( ',', $str, substr_count( $str, ',') - 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BTnOT
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'a%2Cb%2Cc%2Cd%2Ce'
    3     1        INIT_FCALL                                               'substr_count'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2C'
          4        DO_ICALL                                         $2      
          5        ECHO                                                     $2
          6        ECHO                                                     '%0A'
    4     7        INIT_FCALL                                               'implode'
          8        SEND_VAL                                                 '%2C'
          9        INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '%2C'
         11        SEND_VAR                                                 !0
         12        INIT_FCALL                                               'substr_count'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 '%2C'
         15        DO_ICALL                                         $3      
         16        SUB                                              ~4      $3, 1
         17        SEND_VAL                                                 ~4
         18        DO_ICALL                                         $5      
         19        SEND_VAR                                                 $5
         20        DO_ICALL                                         $6      
         21        ECHO                                                     $6
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.68 ms | 1395 KiB | 19 Q