3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value1 = $value2 = 0; $searches = array( "Bredd:", "bredd:", "Bredd=", "bredd=", "Bredd ", "bredd ", "Höjd:", "höjd:", "Höjd=", "höjd=", "Höjd ", "höjd ", ); $tests = array( "Höjd=25,bredd=35", "Höjd=100,bredd=81", "Höjd = 25,bredd = 35", "Höjd:25,bredd:35", "Höjd: 25,bredd: 35", "Höjd : 25,bredd : 35" ); foreach( $tests as $test) { $mSpecParts = explode( ',', $test ); foreach( $mSpecParts as $i => $part ) { $str = ""; foreach( $searches as $search ) { if( strpos( $part, $search) !== false ) { $str = explode( $search, $part ); $str = $str[count($str)-1]; } } if( strlen( $str ) ) { if( $value1 ) { echo " Setting value2 to " . trim( $str ) . "\n"; $value2 = trim( $str ); }else{ echo " Setting value1 to " . trim( $str ) . "\n"; $value1 = trim( $str ); } } } if( $value2 > $value1 ) { $tmp = $value2; $value2 = $value1; $value1 = $tmp; } echo "\n value1 = $value1 & value2 = $value2"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 71
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 71
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 59
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 59
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 33
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 33
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 32
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 32
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 58
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 48
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 58
Branch analysis from position: 33
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 65
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 65
Branch analysis from position: 59
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
filename:       /in/S0nPT
function name:  (null)
number of ops:  73
compiled vars:  !0 = $value1, !1 = $value2, !2 = $searches, !3 = $tests, !4 = $test, !5 = $mSpecParts, !6 = $part, !7 = $i, !8 = $str, !9 = $search, !10 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                           ~11     !1, 0
          1        ASSIGN                                                   !0, ~11
    3     2        ASSIGN                                                   !2, <array>
   17     3        ASSIGN                                                   !3, <array>
   25     4      > FE_RESET_R                                       $15     !3, ->71
          5    > > FE_FETCH_R                                               $15, !4, ->71
   27     6    >   INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%2C'
          8        SEND_VAR                                                 !4
          9        DO_ICALL                                         $16     
         10        ASSIGN                                                   !5, $16
   28    11      > FE_RESET_R                                       $18     !5, ->59
         12    > > FE_FETCH_R                                       ~19     $18, !6, ->59
         13    >   ASSIGN                                                   !7, ~19
   30    14        ASSIGN                                                   !8, ''
   31    15      > FE_RESET_R                                       $22     !2, ->33
         16    > > FE_FETCH_R                                               $22, !9, ->33
   33    17    >   INIT_FCALL                                               'strpos'
         18        SEND_VAR                                                 !6
         19        SEND_VAR                                                 !9
         20        DO_ICALL                                         $23     
         21        TYPE_CHECK                                  1018          $23
         22      > JMPZ                                                     ~24, ->32
   35    23    >   INIT_FCALL                                               'explode'
         24        SEND_VAR                                                 !9
         25        SEND_VAR                                                 !6
         26        DO_ICALL                                         $25     
         27        ASSIGN                                                   !8, $25
   36    28        COUNT                                            ~27     !8
         29        SUB                                              ~28     ~27, 1
         30        FETCH_DIM_R                                      ~29     !8, ~28
         31        ASSIGN                                                   !8, ~29
   31    32    > > JMP                                                      ->16
         33    >   FE_FREE                                                  $22
   39    34        STRLEN                                           ~31     !8
         35      > JMPZ                                                     ~31, ->58
   41    36    > > JMPZ                                                     !0, ->48
   43    37    >   INIT_FCALL                                               'trim'
         38        SEND_VAR                                                 !8
         39        DO_ICALL                                         $32     
         40        CONCAT                                           ~33     '++++Setting+value2+to+', $32
         41        CONCAT                                           ~34     ~33, '%0A'
         42        ECHO                                                     ~34
   44    43        INIT_FCALL                                               'trim'
         44        SEND_VAR                                                 !8
         45        DO_ICALL                                         $35     
         46        ASSIGN                                                   !1, $35
         47      > JMP                                                      ->58
   46    48    >   INIT_FCALL                                               'trim'
         49        SEND_VAR                                                 !8
         50        DO_ICALL                                         $37     
         51        CONCAT                                           ~38     '++++Setting+value1+to+', $37
         52        CONCAT                                           ~39     ~38, '%0A'
         53        ECHO                                                     ~39
   47    54        INIT_FCALL                                               'trim'
         55        SEND_VAR                                                 !8
         56        DO_ICALL                                         $40     
         57        ASSIGN                                                   !0, $40
   28    58    > > JMP                                                      ->12
         59    >   FE_FREE                                                  $18
   51    60        IS_SMALLER                                               !0, !1
         61      > JMPZ                                                     ~42, ->65
   53    62    >   ASSIGN                                                   !10, !1
   54    63        ASSIGN                                                   !1, !0
   55    64        ASSIGN                                                   !0, !10
   57    65    >   ROPE_INIT                                     4  ~47     '%0A+++++value1+%3D+'
         66        ROPE_ADD                                      1  ~47     ~47, !0
         67        ROPE_ADD                                      2  ~47     ~47, '+%26+value2+%3D+'
         68        ROPE_END                                      3  ~46     ~47, !1
         69        ECHO                                                     ~46
   25    70      > JMP                                                      ->5
         71    >   FE_FREE                                                  $15
   58    72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.28 ms | 1408 KiB | 19 Q