3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( '0' => 25, '1' => 30, '2' => 35, '3' => 40, '4' => 45, '5' => 50, '6' => 55, '7' => 60, '8' => 65, '9' => 70, '10' => 75, '11' => 80, '12' => 85, ); $key = 3; $count = 5; $slice = array_slice( $array, ( ( $key - $count ) > 0 ) ? ( $key - $count) : 0 , ( ( $key - $count ) > 0 ) ? ( (2 * $count) + 1 ) : ( (2 * $count) + ( $key - $count + 1 ) ) ); echo '<pre>'; print_r($slice); die;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
Branch analysis from position: 20
filename:       /in/ZpX4l
function name:  (null)
number of ops:  34
compiled vars:  !0 = $array, !1 = $key, !2 = $count, !3 = $slice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, 3
   20     2        ASSIGN                                                   !2, 5
   22     3        INIT_FCALL                                               'array_slice'
   23     4        SEND_VAR                                                 !0
   24     5        SUB                                              ~7      !1, !2
          6        IS_SMALLER                                               0, ~7
          7      > JMPZ                                                     ~8, ->11
          8    >   SUB                                              ~9      !1, !2
          9        QM_ASSIGN                                        ~10     ~9
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~10     0
         12    >   SEND_VAL                                                 ~10
   25    13        SUB                                              ~11     !1, !2
         14        IS_SMALLER                                               0, ~11
         15      > JMPZ                                                     ~12, ->20
         16    >   MUL                                              ~13     !2, 2
         17        ADD                                              ~14     ~13, 1
         18        QM_ASSIGN                                        ~15     ~14
         19      > JMP                                                      ->25
         20    >   MUL                                              ~16     !2, 2
         21        SUB                                              ~17     !1, !2
         22        ADD                                              ~18     ~17, 1
         23        ADD                                              ~19     ~16, ~18
         24        QM_ASSIGN                                        ~15     ~19
         25    >   SEND_VAL                                                 ~15
         26        DO_ICALL                                         $20     
   22    27        ASSIGN                                                   !3, $20
   27    28        ECHO                                                     '%3Cpre%3E'
   28    29        INIT_FCALL                                               'print_r'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                                 
   29    32      > EXIT                                                     
   30    33*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.75 ms | 1401 KiB | 17 Q