3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "tea dae 15 abc 7,2 kg abc aa 1 aa"; $result = ""; if (preg_match('~(\d+(?:,\d+)?)\s*(kg)\b~', $str, $m)) { $result = $m[1] . $m[2]; } echo $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/XSE1J
function name:  (null)
number of ops:  14
compiled vars:  !0 = $str, !1 = $result, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'tea+dae+15+abc+7%2C2+kg+abc+aa+1+aa'
    4     1        ASSIGN                                                   !1, ''
    5     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%7E%28%5Cd%2B%28%3F%3A%2C%5Cd%2B%29%3F%29%5Cs%2A%28kg%29%5Cb%7E'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $5      
          7      > JMPZ                                                     $5, ->12
    6     8    >   FETCH_DIM_R                                      ~6      !2, 1
          9        FETCH_DIM_R                                      ~7      !2, 2
         10        CONCAT                                           ~8      ~6, ~7
         11        ASSIGN                                                   !1, ~8
    8    12    >   ECHO                                                     !1
    9    13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.04 ms | 996 KiB | 14 Q