3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "TEST DEHUMIDIFIER, MUNTERS (M11L) / / / / / / / M11L 230V, 50Hz, 0.21Kw"; print $str . PHP_EOL . '-------------------' . PHP_EOL; preg_match_all("/(\b[a-zA-Z-]{3,}\b)+?/", $str, $matches); print_r($matches[0]); $foo = $matches[0]; foreach ($foo as $bar) { print $bar . ': '; print preg_match('/^[a-z0-9]+([a-z0-9-]+[a-z0-9])?$/iD', $bar); print PHP_EOL; } // stripMeasurements $pattern = "!(?<=\A|[, :-=])\d+[- ]{0,3}(\"|barrel|bag|bottle|box|can|coil|cartridge|case|carton|cup|cylinder|degree|drum|dozen|foot|feet|squarefoot|gallon(us)|inch|gram|hole|jar|kilogram|pound|length|litre|milli-litre|meter|metre|milli-letre|milimetre|squaremetre|cubicmetre|metre|roll|numberofrolls|packet|piece|pail|pair|sack|set|sheet|shortton|tin|metricton|ton|thread|tonne|a|bar|bg|bo|bx|b|ca|cm|cl|cq|ct|cu|cy|cm2|c|deg|dr|din|fot|ftk|gll|grm|gm|hz|in|jr|kg|kgm|kgf|kwh|kw|l|lbr|ln|ltr|rpm|mlt|c2|cc3|c3|ma|m2|m3|mt3|mt2|ml|mm|mmt|mtk|mtq|mtr|m|nrl|pa|pin|psi|pkt|pce|pcs|rol|sa|set|st|stn|tn|tne|tu|va|v|x)[s]?(?=\Z|[, :-=])!i"; print preg_replace($pattern, " ", $str) . PHP_EOL; preg_match_all( "#(?=[a-z-]*\d)[a-zA-Z0-9-.]{4,}(?<=[a-z0-9])#i", $str, $partCandidates1 ); print_r($partCandidates[0]);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 27
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/6Og91
function name:  (null)
number of ops:  46
compiled vars:  !0 = $str, !1 = $matches, !2 = $foo, !3 = $bar, !4 = $pattern, !5 = $partCandidates1, !6 = $partCandidates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'TEST+DEHUMIDIFIER%2C+MUNTERS+%28M11L%29+%2F+%2F+%2F+%2F+%2F+%2F+%2F+M11L+230V%2C+50Hz%2C+0.21Kw'
    3     1        CONCAT                                           ~8      !0, '%0A'
          2        CONCAT                                           ~9      ~8, '-------------------'
          3        CONCAT                                           ~10     ~9, '%0A'
          4        ECHO                                                     ~10
    5     5        INIT_FCALL                                               'preg_match_all'
          6        SEND_VAL                                                 '%2F%28%5Cb%5Ba-zA-Z-%5D%7B3%2C%7D%5Cb%29%2B%3F%2F'
          7        SEND_VAR                                                 !0
          8        SEND_REF                                                 !1
          9        DO_ICALL                                                 
    6    10        INIT_FCALL                                               'print_r'
         11        FETCH_DIM_R                                      ~12     !1, 0
         12        SEND_VAL                                                 ~12
         13        DO_ICALL                                                 
    8    14        FETCH_DIM_R                                      ~14     !1, 0
         15        ASSIGN                                                   !2, ~14
    9    16      > FE_RESET_R                                       $16     !2, ->27
         17    > > FE_FETCH_R                                               $16, !3, ->27
   10    18    >   CONCAT                                           ~17     !3, '%3A+'
         19        ECHO                                                     ~17
   11    20        INIT_FCALL                                               'preg_match'
         21        SEND_VAL                                                 '%2F%5E%5Ba-z0-9%5D%2B%28%5Ba-z0-9-%5D%2B%5Ba-z0-9%5D%29%3F%24%2FiD'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $18     
         24        ECHO                                                     $18
   12    25        ECHO                                                     '%0A'
    9    26      > JMP                                                      ->17
         27    >   FE_FREE                                                  $16
   16    28        ASSIGN                                                   !4, '%21%28%3F%3C%3D%5CA%7C%5B%2C+%3A-%3D%5D%29%5Cd%2B%5B-+%5D%7B0%2C3%7D%28%22%7Cbarrel%7Cbag%7Cbottle%7Cbox%7Ccan%7Ccoil%7Ccartridge%7Ccase%7Ccarton%7Ccup%7Ccylinder%7Cdegree%7Cdrum%7Cdozen%7Cfoot%7Cfeet%7Csquarefoot%7Cgallon%28us%29%7Cinch%7Cgram%7Chole%7Cjar%7Ckilogram%7Cpound%7Clength%7Clitre%7Cmilli-litre%7Cmeter%7Cmetre%7Cmilli-letre%7Cmilimetre%7Csquaremetre%7Ccubicmetre%7Cmetre%7Croll%7Cnumberofrolls%7Cpacket%7Cpiece%7Cpail%7Cpair%7Csack%7Cset%7Csheet%7Cshortton%7Ctin%7Cmetricton%7Cton%7Cthread%7Ctonne%7Ca%7Cbar%7Cbg%7Cbo%7Cbx%7Cb%7Cca%7Ccm%7Ccl%7Ccq%7Cct%7Ccu%7Ccy%7Ccm2%7Cc%7Cdeg%7Cdr%7Cdin%7Cfot%7Cftk%7Cgll%7Cgrm%7Cgm%7Chz%7Cin%7Cjr%7Ckg%7Ckgm%7Ckgf%7Ckwh%7Ckw%7Cl%7Clbr%7Cln%7Cltr%7Crpm%7Cmlt%7Cc2%7Ccc3%7Cc3%7Cma%7Cm2%7Cm3%7Cmt3%7Cmt2%7Cml%7Cmm%7Cmmt%7Cmtk%7Cmtq%7Cmtr%7Cm%7Cnrl%7Cpa%7Cpin%7Cpsi%7Cpkt%7Cpce%7Cpcs%7Crol%7Csa%7Cset%7Cst%7Cstn%7Ctn%7Ctne%7Ctu%7Cva%7Cv%7Cx%29%5Bs%5D%3F%28%3F%3D%5CZ%7C%5B%2C+%3A-%3D%5D%29%21i'
   18    29        INIT_FCALL                                               'preg_replace'
         30        SEND_VAR                                                 !4
         31        SEND_VAL                                                 '+'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $20     
         34        CONCAT                                           ~21     $20, '%0A'
         35        ECHO                                                     ~21
   20    36        INIT_FCALL                                               'preg_match_all'
   21    37        SEND_VAL                                                 '%23%28%3F%3D%5Ba-z-%5D%2A%5Cd%29%5Ba-zA-Z0-9-.%5D%7B4%2C%7D%28%3F%3C%3D%5Ba-z0-9%5D%29%23i'
   22    38        SEND_VAR                                                 !0
   23    39        SEND_REF                                                 !5
         40        DO_ICALL                                                 
   26    41        INIT_FCALL                                               'print_r'
         42        FETCH_DIM_R                                      ~23     !6, 0
         43        SEND_VAL                                                 ~23
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.87 ms | 1400 KiB | 21 Q