3v4l.org

run code in 500+ 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 = 29, Position 2 = 34
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/UgvY0
function name:  (null)
number of ops:  38
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        FRAMELESS_ICALL_2                implode             ~22     '%2C+', !2
         27        SEND_VAL                                                     ~22
   20    28      > JMPZ                                                         !3, ->34
         29    >   ROPE_INIT                                         3  ~24     '+%28%2B'
         30        ROPE_ADD                                          1  ~24     ~24, !3
         31        ROPE_END                                          2  ~23     ~24, '%29'
         32        QM_ASSIGN                                            ~26     ~23
         33      > JMP                                                          ->35
         34    >   QM_ASSIGN                                            ~26     ''
         35    >   SEND_VAL                                                     ~26
   17    36        DO_ICALL                                                     
   21    37      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.05 ms | 1461 KiB | 15 Q