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 ", ); $mSpecStr = "Bredd= 25, Höjd= 35"; $mSpecParts = explode( ',', $mSpecStr ); 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 = 10, Position 2 = 57
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 57
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 31
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 30
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 56
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 46
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 56
Branch analysis from position: 31
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 63
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
Branch analysis from position: 57
filename:       /in/gpHsM
function name:  (null)
number of ops:  69
compiled vars:  !0 = $value1, !1 = $value2, !2 = $searches, !3 = $mSpecStr, !4 = $mSpecParts, !5 = $part, !6 = $i, !7 = $str, !8 = $search, !9 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                           ~10     !1, 0
          1        ASSIGN                                                   !0, ~10
    3     2        ASSIGN                                                   !2, <array>
   17     3        ASSIGN                                                   !3, 'Bredd%3D+25%2C+H%C3%B6jd%3D+35'
   18     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2C'
          6        SEND_VAR                                                 !3
          7        DO_ICALL                                         $14     
          8        ASSIGN                                                   !4, $14
   19     9      > FE_RESET_R                                       $16     !4, ->57
         10    > > FE_FETCH_R                                       ~17     $16, !5, ->57
         11    >   ASSIGN                                                   !6, ~17
   21    12        ASSIGN                                                   !7, ''
   22    13      > FE_RESET_R                                       $20     !2, ->31
         14    > > FE_FETCH_R                                               $20, !8, ->31
   24    15    >   INIT_FCALL                                               'strpos'
         16        SEND_VAR                                                 !5
         17        SEND_VAR                                                 !8
         18        DO_ICALL                                         $21     
         19        TYPE_CHECK                                  1018          $21
         20      > JMPZ                                                     ~22, ->30
   26    21    >   INIT_FCALL                                               'explode'
         22        SEND_VAR                                                 !8
         23        SEND_VAR                                                 !5
         24        DO_ICALL                                         $23     
         25        ASSIGN                                                   !7, $23
   27    26        COUNT                                            ~25     !7
         27        SUB                                              ~26     ~25, 1
         28        FETCH_DIM_R                                      ~27     !7, ~26
         29        ASSIGN                                                   !7, ~27
   22    30    > > JMP                                                      ->14
         31    >   FE_FREE                                                  $20
   30    32        STRLEN                                           ~29     !7
         33      > JMPZ                                                     ~29, ->56
   32    34    > > JMPZ                                                     !0, ->46
   34    35    >   INIT_FCALL                                               'trim'
         36        SEND_VAR                                                 !7
         37        DO_ICALL                                         $30     
         38        CONCAT                                           ~31     '++++Setting+value2+to+', $30
         39        CONCAT                                           ~32     ~31, '%0A'
         40        ECHO                                                     ~32
   35    41        INIT_FCALL                                               'trim'
         42        SEND_VAR                                                 !7
         43        DO_ICALL                                         $33     
         44        ASSIGN                                                   !1, $33
         45      > JMP                                                      ->56
   37    46    >   INIT_FCALL                                               'trim'
         47        SEND_VAR                                                 !7
         48        DO_ICALL                                         $35     
         49        CONCAT                                           ~36     '++++Setting+value1+to+', $35
         50        CONCAT                                           ~37     ~36, '%0A'
         51        ECHO                                                     ~37
   38    52        INIT_FCALL                                               'trim'
         53        SEND_VAR                                                 !7
         54        DO_ICALL                                         $38     
         55        ASSIGN                                                   !0, $38
   19    56    > > JMP                                                      ->10
         57    >   FE_FREE                                                  $16
   42    58        IS_SMALLER                                               !0, !1
         59      > JMPZ                                                     ~40, ->63
   44    60    >   ASSIGN                                                   !9, !1
   45    61        ASSIGN                                                   !1, !0
   46    62        ASSIGN                                                   !0, !9
   48    63    >   ROPE_INIT                                     4  ~45     '%0A+++++value1+%3D+'
         64        ROPE_ADD                                      1  ~45     ~45, !0
         65        ROPE_ADD                                      2  ~45     ~45, '+%26+value2+%3D+'
         66        ROPE_END                                      3  ~44     ~45, !1
         67        ECHO                                                     ~44
         68      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.59 ms | 1400 KiB | 19 Q