3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "2509,2222222"; // Regex number comma number (zero - two) Preg_match("/(\d+),*(\d{0,2})/", $input, $m); Unset($m[0]); // remove full match Echo implode("", $m); // implode parts
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MjcYV
function name:  (null)
number of ops:  13
compiled vars:  !0 = $input, !1 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '2509%2C2222222'
    4     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%28%5Cd%2B%29%2C%2A%28%5Cd%7B0%2C2%7D%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        UNSET_DIM                                                !1, 0
    7     7        INIT_FCALL                                               'implode'
          8        SEND_VAL                                                 ''
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $4      
         11        ECHO                                                     $4
         12      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.01 ms | 1001 KiB | 15 Q