3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total_pages = 100; $current_page = 50; $boundaries = 2; $around = 2; $arr1 = range(1, $boundaries); $arr2 = range($total_pages - max(($boundaries - 1), 0), $total_pages); $arr3 = range(min($current_page - $around, 1), $current_page); $arr4 = range($current_page, $current_page + $around); $result = array_unique(array_merge($arr1, $arr2, $arr3, $arr4)); sort($result); var_dump($arr1 ); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jdWX6
function name:  (null)
number of ops:  53
compiled vars:  !0 = $total_pages, !1 = $current_page, !2 = $boundaries, !3 = $around, !4 = $arr1, !5 = $arr2, !6 = $arr3, !7 = $arr4, !8 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100
    4     1        ASSIGN                                                   !1, 50
    5     2        ASSIGN                                                   !2, 2
    6     3        ASSIGN                                                   !3, 2
    8     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $13     
          8        ASSIGN                                                   !4, $13
    9     9        INIT_FCALL                                               'range'
         10        INIT_FCALL                                               'max'
         11        SUB                                              ~15     !2, 1
         12        SEND_VAL                                                 ~15
         13        SEND_VAL                                                 0
         14        DO_ICALL                                         $16     
         15        SUB                                              ~17     !0, $16
         16        SEND_VAL                                                 ~17
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $18     
         19        ASSIGN                                                   !5, $18
   11    20        INIT_FCALL                                               'range'
         21        INIT_FCALL                                               'min'
         22        SUB                                              ~20     !1, !3
         23        SEND_VAL                                                 ~20
         24        SEND_VAL                                                 1
         25        DO_ICALL                                         $21     
         26        SEND_VAR                                                 $21
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $22     
         29        ASSIGN                                                   !6, $22
   12    30        INIT_FCALL                                               'range'
         31        SEND_VAR                                                 !1
         32        ADD                                              ~24     !1, !3
         33        SEND_VAL                                                 ~24
         34        DO_ICALL                                         $25     
         35        ASSIGN                                                   !7, $25
   14    36        INIT_FCALL                                               'array_unique'
         37        INIT_FCALL                                               'array_merge'
         38        SEND_VAR                                                 !4
         39        SEND_VAR                                                 !5
         40        SEND_VAR                                                 !6
         41        SEND_VAR                                                 !7
         42        DO_ICALL                                         $27     
         43        SEND_VAR                                                 $27
         44        DO_ICALL                                         $28     
         45        ASSIGN                                                   !8, $28
   15    46        INIT_FCALL                                               'sort'
         47        SEND_REF                                                 !8
         48        DO_ICALL                                                 
   17    49        INIT_FCALL                                               'var_dump'
         50        SEND_VAR                                                 !4
         51        DO_ICALL                                                 
   18    52      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.54 ms | 1400 KiB | 27 Q