3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ '+2347036756899', '+234-7036-756899', '+2347036-756899', '+234-7036756899', '07036756899', '0-7036756899', '07036-756899', '08036756899', ]; foreach ($tests as $test) { printf( "%20s : %s\n", $test, preg_match('/^(?:\+234(-)?|0)(?:[78]0|81)\d{2}(?(1)-|)\d{6}$/', $test) ? '✅' : '❌' ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 17
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/YkTVJ
function name:  (null)
number of ops:  19
compiled vars:  !0 = $tests, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1      > FE_RESET_R                                       $3      !0, ->17
          2    > > FE_FETCH_R                                               $3, !1, ->17
   15     3    >   INIT_FCALL                                               'printf'
   16     4        SEND_VAL                                                 '%2520s+%3A+%25s%0A'
   17     5        SEND_VAR                                                 !1
   18     6        INIT_FCALL                                               'preg_match'
          7        SEND_VAL                                                 '%2F%5E%28%3F%3A%5C%2B234%28-%29%3F%7C0%29%28%3F%3A%5B78%5D0%7C81%29%5Cd%7B2%7D%28%3F%281%29-%7C%29%5Cd%7B6%7D%24%2F'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $4      
         10      > JMPZ                                                     $4, ->13
         11    >   QM_ASSIGN                                        ~5      '%E2%9C%85'
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~5      '%E2%9D%8C'
         14    >   SEND_VAL                                                 ~5
         15        DO_ICALL                                                 
   14    16      > JMP                                                      ->2
         17    >   FE_FREE                                                  $3
   20    18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.76 ms | 1400 KiB | 17 Q