3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = "100% Wool"; $separators = [ "/", ",", "&", " AND " ]; $value = str_replace($separators, "|", $value); $candidates = explode("|", $value); $percentage = (count($candidates) == 1) ? "100%" : null; if($candidate = trim($candidate)){ if(strpos("%", $candidate) !== false) { list($percentage, $material) = explode("%", $candidate); $percentage .= "%"; } else { $material = $candidate; } $entities = $this->mapping['material']; if($id = $this->exact($material, $entities)) { $material = [ 'material_id' => $id, 'percentage' => $percentage ]; $product['materials'][] = $material; } else { } } print_r($product['materials']);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 61
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 42
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 61
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 61
Branch analysis from position: 54
Branch analysis from position: 61
Branch analysis from position: 61
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 61
Branch analysis from position: 25
Branch analysis from position: 61
filename:       /in/NlhnI
function name:  (null)
number of ops:  66
compiled vars:  !0 = $value, !1 = $separators, !2 = $candidates, !3 = $percentage, !4 = $candidate, !5 = $material, !6 = $entities, !7 = $id, !8 = $product
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '100%25+Wool'
    4     1        ASSIGN                                                   !1, <array>
   11     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%7C'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !0, $11
   12     8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%7C'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !2, $13
   13    13        COUNT                                            ~15     !2
         14        IS_EQUAL                                                 ~15, 1
         15      > JMPZ                                                     ~16, ->18
         16    >   QM_ASSIGN                                        ~17     '100%25'
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~17     null
         19    >   ASSIGN                                                   !3, ~17
   14    20        INIT_FCALL                                               'trim'
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                         $19     
         23        ASSIGN                                           ~20     !4, $19
         24      > JMPZ                                                     ~20, ->61
   15    25    >   INIT_FCALL                                               'strpos'
         26        SEND_VAL                                                 '%25'
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                         $21     
         29        TYPE_CHECK                                  1018          $21
         30      > JMPZ                                                     ~22, ->42
   16    31    >   INIT_FCALL                                               'explode'
         32        SEND_VAL                                                 '%25'
         33        SEND_VAR                                                 !4
         34        DO_ICALL                                         $23     
         35        FETCH_LIST_R                                     $24     $23, 0
         36        ASSIGN                                                   !3, $24
         37        FETCH_LIST_R                                     $26     $23, 1
         38        ASSIGN                                                   !5, $26
         39        FREE                                                     $23
   17    40        ASSIGN_OP                                     8          !3, '%25'
         41      > JMP                                                      ->43
   19    42    >   ASSIGN                                                   !5, !4
   22    43    >   FETCH_THIS                                       $30     
         44        FETCH_OBJ_R                                      ~31     $30, 'mapping'
         45        FETCH_DIM_R                                      ~32     ~31, 'material'
         46        ASSIGN                                                   !6, ~32
   23    47        FETCH_THIS                                       $34     
         48        INIT_METHOD_CALL                                         $34, 'exact'
         49        SEND_VAR_EX                                              !5
         50        SEND_VAR_EX                                              !6
         51        DO_FCALL                                      0  $35     
         52        ASSIGN                                           ~36     !7, $35
         53      > JMPZ                                                     ~36, ->61
   25    54    >   INIT_ARRAY                                       ~37     !7, 'material_id'
   26    55        ADD_ARRAY_ELEMENT                                ~37     !3, 'percentage'
   24    56        ASSIGN                                                   !5, ~37
   28    57        FETCH_DIM_W                                      $39     !8, 'materials'
         58        ASSIGN_DIM                                               $39
         59        OP_DATA                                                  !5
         60      > JMP                                                      ->61
   34    61    >   INIT_FCALL                                               'print_r'
         62        FETCH_DIM_R                                      ~41     !8, 'materials'
         63        SEND_VAL                                                 ~41
         64        DO_ICALL                                                 
         65      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.6 ms | 945 KiB | 24 Q