3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Find id's of previous and next product in featured module $products = $this->model_catalog_product->getProducts(); $product_id = (int)$this->request->get['product_id']; $key = array_search($product_id, array_column($products, 'product_id')); $products = array_values($products); if ($key === 0) { $temp = end($products); $data['prev_product_id'] = $temp['product_id']; } else { $data['prev_product_id'] = $products[$key - 1]['product_id']; } if ($key === count($products) - 1) { $temp = reset($products); $data['next_product_id'] = $temp['product_id']; } else { $data['next_product_id'] = $products[$key + 1]['product_id']; } // Find last image of previous product $prev_product_images = $this->model_catalog_product->getProductImages($data['prev_product_id']); $prev_product_last_image = end($prev_product_images); if ($prev_product_last_image) { $data['prev_product_image'] = $this->model_tool_image->placeholder_image($prev_product_last_image['image']); } else { $data['prev_product_image'] = ''; } // Find first image of next product $next_product_images = $this->model_catalog_product->getProductImages($data['next_product_id']); $next_product_first_image = current($next_product_images); if ($next_product_first_image) { $data['next_product_image'] = $this->model_tool_image->placeholder_image($next_product_first_image['image']); } else { $data['next_product_image'] = ''; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 51
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 79
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 81
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 104
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 104
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 104
Branch analysis from position: 94
Branch analysis from position: 104
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 79
Branch analysis from position: 69
Branch analysis from position: 79
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 51
Branch analysis from position: 43
Branch analysis from position: 51
filename:       /in/NUvf3
function name:  (null)
number of ops:  107
compiled vars:  !0 = $products, !1 = $product_id, !2 = $key, !3 = $temp, !4 = $data, !5 = $prev_product_images, !6 = $prev_product_last_image, !7 = $next_product_images, !8 = $next_product_first_image
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_THIS                                       $9      
          1        FETCH_OBJ_R                                      ~10     $9, 'model_catalog_product'
          2        INIT_METHOD_CALL                                         ~10, 'getProducts'
          3        DO_FCALL                                      0  $11     
          4        ASSIGN                                                   !0, $11
    4     5        FETCH_THIS                                       $13     
          6        FETCH_OBJ_R                                      ~14     $13, 'request'
          7        FETCH_OBJ_R                                      ~15     ~14, 'get'
          8        FETCH_DIM_R                                      ~16     ~15, 'product_id'
          9        CAST                                          4  ~17     ~16
         10        ASSIGN                                                   !1, ~17
    5    11        INIT_FCALL                                               'array_search'
         12        SEND_VAR                                                 !1
         13        INIT_FCALL                                               'array_column'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 'product_id'
         16        DO_ICALL                                         $19     
         17        SEND_VAR                                                 $19
         18        DO_ICALL                                         $20     
         19        ASSIGN                                                   !2, $20
    6    20        INIT_FCALL                                               'array_values'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $22     
         23        ASSIGN                                                   !0, $22
    8    24        IS_IDENTICAL                                             !2, 0
         25      > JMPZ                                                     ~24, ->34
    9    26    >   INIT_FCALL                                               'end'
         27        SEND_REF                                                 !0
         28        DO_ICALL                                         $25     
         29        ASSIGN                                                   !3, $25
   10    30        FETCH_DIM_R                                      ~28     !3, 'product_id'
         31        ASSIGN_DIM                                               !4, 'prev_product_id'
         32        OP_DATA                                                  ~28
         33      > JMP                                                      ->39
   12    34    >   SUB                                              ~30     !2, 1
         35        FETCH_DIM_R                                      ~31     !0, ~30
         36        FETCH_DIM_R                                      ~32     ~31, 'product_id'
         37        ASSIGN_DIM                                               !4, 'prev_product_id'
         38        OP_DATA                                                  ~32
   15    39    >   COUNT                                            ~33     !0
         40        SUB                                              ~34     ~33, 1
         41        IS_IDENTICAL                                             !2, ~34
         42      > JMPZ                                                     ~35, ->51
   16    43    >   INIT_FCALL                                               'reset'
         44        SEND_REF                                                 !0
         45        DO_ICALL                                         $36     
         46        ASSIGN                                                   !3, $36
   17    47        FETCH_DIM_R                                      ~39     !3, 'product_id'
         48        ASSIGN_DIM                                               !4, 'next_product_id'
         49        OP_DATA                                                  ~39
         50      > JMP                                                      ->56
   19    51    >   ADD                                              ~41     !2, 1
         52        FETCH_DIM_R                                      ~42     !0, ~41
         53        FETCH_DIM_R                                      ~43     ~42, 'product_id'
         54        ASSIGN_DIM                                               !4, 'next_product_id'
         55        OP_DATA                                                  ~43
   23    56    >   FETCH_THIS                                       $44     
         57        FETCH_OBJ_R                                      ~45     $44, 'model_catalog_product'
         58        INIT_METHOD_CALL                                         ~45, 'getProductImages'
         59        CHECK_FUNC_ARG                                           
         60        FETCH_DIM_FUNC_ARG                               $46     !4, 'prev_product_id'
         61        SEND_FUNC_ARG                                            $46
         62        DO_FCALL                                      0  $47     
         63        ASSIGN                                                   !5, $47
   24    64        INIT_FCALL                                               'end'
         65        SEND_REF                                                 !5
         66        DO_ICALL                                         $49     
         67        ASSIGN                                                   !6, $49
   26    68      > JMPZ                                                     !6, ->79
   27    69    >   FETCH_THIS                                       $52     
         70        FETCH_OBJ_R                                      ~53     $52, 'model_tool_image'
         71        INIT_METHOD_CALL                                         ~53, 'placeholder_image'
         72        CHECK_FUNC_ARG                                           
         73        FETCH_DIM_FUNC_ARG                               $54     !6, 'image'
         74        SEND_FUNC_ARG                                            $54
         75        DO_FCALL                                      0  $55     
         76        ASSIGN_DIM                                               !4, 'prev_product_image'
         77        OP_DATA                                                  $55
         78      > JMP                                                      ->81
   29    79    >   ASSIGN_DIM                                               !4, 'prev_product_image'
         80        OP_DATA                                                  ''
   33    81    >   FETCH_THIS                                       $57     
         82        FETCH_OBJ_R                                      ~58     $57, 'model_catalog_product'
         83        INIT_METHOD_CALL                                         ~58, 'getProductImages'
         84        CHECK_FUNC_ARG                                           
         85        FETCH_DIM_FUNC_ARG                               $59     !4, 'next_product_id'
         86        SEND_FUNC_ARG                                            $59
         87        DO_FCALL                                      0  $60     
         88        ASSIGN                                                   !7, $60
   34    89        INIT_FCALL                                               'current'
         90        SEND_VAR                                                 !7
         91        DO_ICALL                                         $62     
         92        ASSIGN                                                   !8, $62
   36    93      > JMPZ                                                     !8, ->104
   37    94    >   FETCH_THIS                                       $65     
         95        FETCH_OBJ_R                                      ~66     $65, 'model_tool_image'
         96        INIT_METHOD_CALL                                         ~66, 'placeholder_image'
         97        CHECK_FUNC_ARG                                           
         98        FETCH_DIM_FUNC_ARG                               $67     !8, 'image'
         99        SEND_FUNC_ARG                                            $67
        100        DO_FCALL                                      0  $68     
        101        ASSIGN_DIM                                               !4, 'next_product_image'
        102        OP_DATA                                                  $68
        103      > JMP                                                      ->106
   39   104    >   ASSIGN_DIM                                               !4, 'next_product_image'
        105        OP_DATA                                                  ''
   40   106    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.3 ms | 1404 KiB | 25 Q