3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Prepare current, total pages and pagination container $current = isset($_GET['page']) ? intval($_GET['page']) : 1; $total = 5; $pagination = []; // Check if pagination required if ($total > 1) { // Check if current page is not first page if ($current > 1) { $pagination[] = '<a class="pagination_backward" href="#">قبلی</a>'; $pagination[] = '<span style="color:#848d95; margin:0px 10px;">…</span>'; } // Iterate through pages for ($i = 1; $i <= $total; $i++) { // Check if handling current page if ($i === $current) { $pagination[] = '<a class="pagination_active" href="#">' . $i . '</a>'; } else { $pagination[] = '<a href="#">' . $i . '</a>'; } } // Check if current page is not last page if ($current < $total) { $pagination[] = '<span style="color:#848d95; margin:0px 10px;">…</span>'; $pagination[] = '<a class="pagination_backward" href="#">بعدی</a>'; } } var_dump($pagination);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 42
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 22
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 42
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 22
Branch analysis from position: 36
Branch analysis from position: 22
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 22
Branch analysis from position: 36
Branch analysis from position: 22
Branch analysis from position: 20
Branch analysis from position: 42
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 42
Branch analysis from position: 14
Branch analysis from position: 42
filename:       /in/JPC7Q
function name:  (null)
number of ops:  46
compiled vars:  !0 = $current, !1 = $total, !2 = $pagination, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   FETCH_IS                                             ~4      '_GET'
          1        ISSET_ISEMPTY_DIM_OBJ                             0          ~4, 'page'
          2      > JMPZ                                                         ~5, ->8
          3    >   FETCH_R                          global              ~6      '_GET'
          4        FETCH_DIM_R                                          ~7      ~6, 'page'
          5        CAST                                              4  ~8      ~7
          6        QM_ASSIGN                                            ~9      ~8
          7      > JMP                                                          ->9
          8    >   QM_ASSIGN                                            ~9      1
          9    >   ASSIGN                                                       !0, ~9
    4    10        ASSIGN                                                       !1, 5
    5    11        ASSIGN                                                       !2, <array>
    8    12        IS_SMALLER                                                   1, !1
         13      > JMPZ                                                         ~13, ->42
   10    14    >   IS_SMALLER                                                   1, !0
         15      > JMPZ                                                         ~14, ->20
   11    16    >   ASSIGN_DIM                                                   !2
         17        OP_DATA                                                      '%3Ca+class%3D%22pagination_backward%22+href%3D%22%23%22%3E%D9%82%D8%A8%D9%84%DB%8C%3C%2Fa%3E'
   12    18        ASSIGN_DIM                                                   !2
         19        OP_DATA                                                      '%3Cspan+style%3D%22color%3A%23848d95%3B+margin%3A0px+10px%3B%22%3E%E2%80%A6%3C%2Fspan%3E'
   16    20    >   ASSIGN                                                       !3, 1
         21      > JMP                                                          ->34
   18    22    >   IS_IDENTICAL                                                 !3, !0
         23      > JMPZ                                                         ~18, ->29
   19    24    >   CONCAT                                               ~20     '%3Ca+class%3D%22pagination_active%22+href%3D%22%23%22%3E', !3
         25        CONCAT                                               ~21     ~20, '%3C%2Fa%3E'
         26        ASSIGN_DIM                                                   !2
         27        OP_DATA                                                      ~21
   18    28      > JMP                                                          ->33
   22    29    >   CONCAT                                               ~23     '%3Ca+href%3D%22%23%22%3E', !3
         30        CONCAT                                               ~24     ~23, '%3C%2Fa%3E'
         31        ASSIGN_DIM                                                   !2
         32        OP_DATA                                                      ~24
   16    33    >   PRE_INC                                                      !3
         34    >   IS_SMALLER_OR_EQUAL                                          !3, !1
         35      > JMPNZ                                                        ~26, ->22
   27    36    >   IS_SMALLER                                                   !0, !1
         37      > JMPZ                                                         ~27, ->42
   28    38    >   ASSIGN_DIM                                                   !2
         39        OP_DATA                                                      '%3Cspan+style%3D%22color%3A%23848d95%3B+margin%3A0px+10px%3B%22%3E%E2%80%A6%3C%2Fspan%3E'
   29    40        ASSIGN_DIM                                                   !2
         41        OP_DATA                                                      '%3Ca+class%3D%22pagination_backward%22+href%3D%22%23%22%3E%D8%A8%D8%B9%D8%AF%DB%8C%3C%2Fa%3E'
   34    42    >   INIT_FCALL                                                   'var_dump'
         43        SEND_VAR                                                     !2
         44        DO_ICALL                                                     
         45      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
229.38 ms | 2316 KiB | 14 Q