3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arrays[] = array(); $arrays[] = array('user1'); $arrays[] = array('user1', 'user2'); $arrays[] = array('user1', 'user2', 'user3'); $arrays[] = array('user1', 'user2', 'user3', 'user4'); $arrays[] = array('user1', 'user2', 'user3', 'user4', 'user5'); foreach ($arrays as $i => $array) { echo "TEST $i: "; if (!$count = sizeof($array)) { echo "nobody"; } elseif ($count < 3) { echo implode(' and ', $array); } else{ echo "{$array[0]}, {$array[1]}"; if ($count == 3) { echo ", and {$array[2]}"; } else { echo ", {$array[2]}, and " , $count - 3, " other" , ($count != 4 ? 's' : ''); } } echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 59
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 59
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
filename:       /in/7QKNr
function name:  (null)
number of ops:  61
compiled vars:  !0 = $arrays, !1 = $array, !2 = $i, !3 = $count
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN_DIM                                                   !0
          1        OP_DATA                                                      <array>
    3     2        ASSIGN_DIM                                                   !0
          3        OP_DATA                                                      <array>
    4     4        ASSIGN_DIM                                                   !0
          5        OP_DATA                                                      <array>
    5     6        ASSIGN_DIM                                                   !0
          7        OP_DATA                                                      <array>
    6     8        ASSIGN_DIM                                                   !0
          9        OP_DATA                                                      <array>
    7    10        ASSIGN_DIM                                                   !0
         11        OP_DATA                                                      <array>
    9    12      > FE_RESET_R                                           $10     !0, ->59
         13    > > FE_FETCH_R                                           ~11     $10, !1, ->59
         14    >   ASSIGN                                                       !2, ~11
   10    15        ROPE_INIT                                         3  ~14     'TEST+'
         16        ROPE_ADD                                          1  ~14     ~14, !2
         17        ROPE_END                                          2  ~13     ~14, '%3A+'
         18        ECHO                                                         ~13
   11    19        COUNT                                                ~16     !1
         20        ASSIGN                                               ~17     !3, ~16
         21        BOOL_NOT                                             ~18     ~17
         22      > JMPZ                                                         ~18, ->25
   12    23    >   ECHO                                                         'nobody'
   11    24      > JMP                                                          ->57
   13    25    >   IS_SMALLER                                                   !3, 3
         26      > JMPZ                                                         ~19, ->30
   14    27    >   FRAMELESS_ICALL_2                implode             ~20     '+and+', !1
         28        ECHO                                                         ~20
   13    29      > JMP                                                          ->57
   16    30    >   FETCH_DIM_R                                          ~21     !1, 0
         31        ROPE_INIT                                         3  ~24     ~21
         32        ROPE_ADD                                          1  ~24     ~24, '%2C+'
         33        FETCH_DIM_R                                          ~22     !1, 1
         34        ROPE_END                                          2  ~23     ~24, ~22
         35        ECHO                                                         ~23
   17    36        IS_EQUAL                                                     !3, 3
         37      > JMPZ                                                         ~26, ->43
   18    38    >   NOP                                                          
         39        FETCH_DIM_R                                          ~27     !1, 2
         40        FAST_CONCAT                                          ~28     '%2C+and+', ~27
         41        ECHO                                                         ~28
   17    42      > JMP                                                          ->57
   20    43    >   ROPE_INIT                                         3  ~31     '%2C+'
         44        FETCH_DIM_R                                          ~29     !1, 2
         45        ROPE_ADD                                          1  ~31     ~31, ~29
         46        ROPE_END                                          2  ~30     ~31, '%2C+and+'
         47        ECHO                                                         ~30
         48        SUB                                                  ~33     !3, 3
         49        ECHO                                                         ~33
         50        ECHO                                                         '+other'
         51        IS_NOT_EQUAL                                                 !3, 4
         52      > JMPZ                                                         ~34, ->55
         53    >   QM_ASSIGN                                            ~35     's'
         54      > JMP                                                          ->56
         55    >   QM_ASSIGN                                            ~35     ''
         56    >   ECHO                                                         ~35
   23    57    >   ECHO                                                         '%0A---%0A'
    9    58      > JMP                                                          ->13
         59    >   FE_FREE                                                      $10
   24    60      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.96 ms | 2112 KiB | 13 Q