3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'Person ONE, Person TWO, Person THREE'; $strArr = explode(',', $str); if(count($strArr) > 2){ //echo trim($strArr[0]).', '.trim($strArr[1]).'...'; $temp = array_slice($strArr,0,2); echo implode(',',$temp).'...'; }else{ echo $str; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pXAaM
function name:  (null)
number of ops:  24
compiled vars:  !0 = $str, !1 = $strArr, !2 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Person+ONE%2C+Person+TWO%2C+Person+THREE'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        COUNT                                            ~6      !1
          7        IS_SMALLER                                               2, ~6
          8      > JMPZ                                                     ~7, ->22
    7     9    >   INIT_FCALL                                               'array_slice'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !2, $8
    8    15        INIT_FCALL                                               'implode'
         16        SEND_VAL                                                 '%2C'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $10     
         19        CONCAT                                           ~11     $10, '...'
         20        ECHO                                                     ~11
         21      > JMP                                                      ->23
   10    22    >   ECHO                                                     !0
   11    23    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.24 ms | 1399 KiB | 19 Q