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) { $count = count($array); printf( "TEST %d: %s\n---\n", $i, match ($count) { 0 => 'nobody', 1 => $array[0], 2 => implode(' and ', $array), 3 => "{$array[0]}, {$array[1]}, and {$array[2]}", default => "{$array[0]}, {$array[1]}, {$array[2]}, and " . $count - 3 . " other" . ($count != 4 ? 's' : '') } ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 65
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 65
Branch analysis from position: 14
5 jumps found. (Code = 195) Position 1 = 21, Position 2 = 23, Position 3 = 26, Position 4 = 32, Position 5 = 42
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 42
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 = 62
Branch analysis from position: 62
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 65
filename:       /in/TPQE5
function name:  (null)
number of ops:  67
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, ->65
         13    > > FE_FETCH_R                                       ~11     $10, !1, ->65
         14    >   ASSIGN                                                   !2, ~11
   10    15        COUNT                                            ~13     !1
         16        ASSIGN                                                   !3, ~13
   11    17        INIT_FCALL                                               'printf'
   12    18        SEND_VAL                                                 'TEST+%25d%3A+%25s%0A---%0A'
   13    19        SEND_VAR                                                 !2
   14    20      > MATCH                                                    !3, [ 0:->21, 1:->23, 2:->26, 3:->32, ], ->42
   15    21    >   QM_ASSIGN                                        ~16     'nobody'
         22      > JMP                                                      ->62
   16    23    >   FETCH_DIM_R                                      ~17     !1, 0
         24        QM_ASSIGN                                        ~16     ~17
         25      > JMP                                                      ->62
   17    26    >   INIT_FCALL                                               'implode'
         27        SEND_VAL                                                 '+and+'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $18     
         30        QM_ASSIGN                                        ~16     $18
         31      > JMP                                                      ->62
   18    32    >   FETCH_DIM_R                                      ~19     !1, 0
         33        ROPE_INIT                                     5  ~23     ~19
         34        ROPE_ADD                                      1  ~23     ~23, '%2C+'
         35        FETCH_DIM_R                                      ~20     !1, 1
         36        ROPE_ADD                                      2  ~23     ~23, ~20
         37        ROPE_ADD                                      3  ~23     ~23, '%2C+and+'
         38        FETCH_DIM_R                                      ~21     !1, 2
         39        ROPE_END                                      4  ~22     ~23, ~21
         40        QM_ASSIGN                                        ~16     ~22
         41      > JMP                                                      ->62
   19    42    >   FETCH_DIM_R                                      ~26     !1, 0
         43        ROPE_INIT                                     6  ~30     ~26
         44        ROPE_ADD                                      1  ~30     ~30, '%2C+'
         45        FETCH_DIM_R                                      ~27     !1, 1
         46        ROPE_ADD                                      2  ~30     ~30, ~27
         47        ROPE_ADD                                      3  ~30     ~30, '%2C+'
         48        FETCH_DIM_R                                      ~28     !1, 2
         49        ROPE_ADD                                      4  ~30     ~30, ~28
         50        ROPE_END                                      5  ~29     ~30, '%2C+and+'
         51        SUB                                              ~33     !3, 3
         52        CONCAT                                           ~34     ~29, ~33
         53        CONCAT                                           ~35     ~34, '+other'
         54        IS_NOT_EQUAL                                             !3, 4
         55      > JMPZ                                                     ~36, ->58
         56    >   QM_ASSIGN                                        ~37     's'
         57      > JMP                                                      ->59
         58    >   QM_ASSIGN                                        ~37     ''
         59    >   CONCAT                                           ~38     ~35, ~37
         60        QM_ASSIGN                                        ~16     ~38
         61      > JMP                                                      ->62
         62    >   SEND_VAL                                                 ~16
   11    63        DO_ICALL                                                 
    9    64      > JMP                                                      ->13
         65    >   FE_FREE                                                  $10
   22    66      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
220.32 ms | 1004 KiB | 15 Q