3v4l.org

run code in 300+ 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 = 62
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 62
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 = 60
Branch analysis from position: 60
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 = 33
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 46
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 58
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 62
filename:       /in/7QKNr
function name:  (null)
number of ops:  64
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, ->62
         13    > > FE_FETCH_R                                       ~11     $10, !1, ->62
         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                                                      ->60
   13    25    >   IS_SMALLER                                               !3, 3
         26      > JMPZ                                                     ~19, ->33
   14    27    >   INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '+and+'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $20     
         31        ECHO                                                     $20
   13    32      > JMP                                                      ->60
   16    33    >   FETCH_DIM_R                                      ~21     !1, 0
         34        ROPE_INIT                                     3  ~24     ~21
         35        ROPE_ADD                                      1  ~24     ~24, '%2C+'
         36        FETCH_DIM_R                                      ~22     !1, 1
         37        ROPE_END                                      2  ~23     ~24, ~22
         38        ECHO                                                     ~23
   17    39        IS_EQUAL                                                 !3, 3
         40      > JMPZ                                                     ~26, ->46
   18    41    >   NOP                                                      
         42        FETCH_DIM_R                                      ~27     !1, 2
         43        FAST_CONCAT                                      ~28     '%2C+and+', ~27
         44        ECHO                                                     ~28
   17    45      > JMP                                                      ->60
   20    46    >   ROPE_INIT                                     3  ~31     '%2C+'
         47        FETCH_DIM_R                                      ~29     !1, 2
         48        ROPE_ADD                                      1  ~31     ~31, ~29
         49        ROPE_END                                      2  ~30     ~31, '%2C+and+'
         50        ECHO                                                     ~30
         51        SUB                                              ~33     !3, 3
         52        ECHO                                                     ~33
         53        ECHO                                                     '+other'
         54        IS_NOT_EQUAL                                             !3, 4
         55      > JMPZ                                                     ~34, ->58
         56    >   QM_ASSIGN                                        ~35     's'
         57      > JMP                                                      ->59
         58    >   QM_ASSIGN                                        ~35     ''
         59    >   ECHO                                                     ~35
   23    60    >   ECHO                                                     '%0A---%0A'
    9    61      > JMP                                                      ->13
         62    >   FE_FREE                                                  $10
   24    63      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.08 ms | 1007 KiB | 14 Q