3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = array( '+380671072122','+3 80671072122','+3 8 067 107 21 22','+38(067)1072122','+38 (067) 107 21 22','+3 8067 107-21-22','067 107 21 22','067-107-21-22' ); foreach($test as $t){ $number = preg_replace('/^(\+)?\D+/', '', $t); print_r($number.PHP_EOL); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 14
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/aqaYB
function name:  (null)
number of ops:  16
compiled vars:  !0 = $test, !1 = $t, !2 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1      > FE_RESET_R                                       $4      !0, ->14
          2    > > FE_FETCH_R                                               $4, !1, ->14
    8     3    >   INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%2F%5E%28%5C%2B%29%3F%5CD%2B%2F'
          5        SEND_VAL                                                 ''
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
    9     9        INIT_FCALL                                               'print_r'
         10        CONCAT                                           ~7      !2, '%0A'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
    6    13      > JMP                                                      ->2
         14    >   FE_FREE                                                  $4
   10    15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.4 ms | 1395 KiB | 17 Q