3v4l.org

run code in 300+ PHP versions simultaneously
<?php $usr = (object)[ 'interests' => 'Cats,Dogs,Monkeys,Praying Mantises,Octopuses,Arowanas,Sloths,Tasmanian Tigers' ]; $showMax = 3; $interests = []; $extra = 0; foreach (explode(',', $usr->interests) as $i => $v) { if ($i < $showMax) { $interests[] = "<span>$v</span>"; } else { ++$extra; } } printf( 'Interested in: %s%s', implode(', ', $interests), $extra ? " (+$extra)" : '' );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/UgvY0
function name:  (null)
number of ops:  41
compiled vars:  !0 = $usr, !1 = $showMax, !2 = $interests, !3 = $extra, !4 = $v, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~6      <array>
    3     1        ASSIGN                                                   !0, ~6
    6     2        ASSIGN                                                   !1, 3
    8     3        ASSIGN                                                   !2, <array>
    9     4        ASSIGN                                                   !3, 0
   10     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '%2C'
          7        FETCH_OBJ_R                                      ~11     !0, 'interests'
          8        SEND_VAL                                                 ~11
          9        DO_ICALL                                         $12     
         10      > FE_RESET_R                                       $13     $12, ->23
         11    > > FE_FETCH_R                                       ~14     $13, !4, ->23
         12    >   ASSIGN                                                   !5, ~14
   11    13        IS_SMALLER                                               !5, !1
         14      > JMPZ                                                     ~16, ->21
   12    15    >   ROPE_INIT                                     3  ~19     '%3Cspan%3E'
         16        ROPE_ADD                                      1  ~19     ~19, !4
         17        ROPE_END                                      2  ~18     ~19, '%3C%2Fspan%3E'
         18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  ~18
   11    20      > JMP                                                      ->22
   14    21    >   PRE_INC                                                  !3
   10    22    > > JMP                                                      ->11
         23    >   FE_FREE                                                  $13
   17    24        INIT_FCALL                                               'printf'
   18    25        SEND_VAL                                                 'Interested+in%3A+%25s%25s'
   19    26        INIT_FCALL                                               'implode'
         27        SEND_VAL                                                 '%2C+'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $22     
         30        SEND_VAR                                                 $22
   20    31      > JMPZ                                                     !3, ->37
         32    >   ROPE_INIT                                     3  ~24     '+%28%2B'
         33        ROPE_ADD                                      1  ~24     ~24, !3
         34        ROPE_END                                      2  ~23     ~24, '%29'
         35        QM_ASSIGN                                        ~26     ~23
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~26     ''
         38    >   SEND_VAL                                                 ~26
   17    39        DO_ICALL                                                 
   21    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.91 ms | 1017 KiB | 16 Q