3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = '123456-1234567890'; if (! preg_match('/((\d{0,6})-)?(\d{1,10})/', $value, $matches)) { echo 'nope'; } print_r($matches); if (!$matches[1]) { echo 'test'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 9
filename:       /in/5EjcJ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $value, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '123456-1234567890'
    4     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%28%28%5Cd%7B0%2C6%7D%29-%29%3F%28%5Cd%7B1%2C10%7D%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $3      
          6        BOOL_NOT                                         ~4      $3
          7      > JMPZ                                                     ~4, ->9
    5     8    >   ECHO                                                     'nope'
    8     9    >   INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   10    12        FETCH_DIM_R                                      ~6      !1, 1
         13        BOOL_NOT                                         ~7      ~6
         14      > JMPZ                                                     ~7, ->16
   11    15    >   ECHO                                                     'test'
   12    16    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.58 ms | 1395 KiB | 17 Q