3v4l.org

run code in 300+ PHP versions simultaneously
<?php $telefones = ['(11) 5550 - 5550', '(11) 96660 - 6660', '(11) 90000 - 0000']; foreach ($telefones as $telefone){ $regex = '/^\(([0-9]{2})\) (9?[0-9]{4} - [0-9]{4})$/'; $telefoneValido = preg_match ( $regex, $telefone ); if ($telefoneValido){ echo 'Telefone Valido'.PHP_EOL; } else echo 'Telefone Invalido'.PHP_EOL; echo preg_replace( $regex, '(XX) \2', $telefone .PHP_EOL ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/WLdCY
function name:  (null)
number of ops:  23
compiled vars:  !0 = $telefones, !1 = $telefone, !2 = $regex, !3 = $telefoneValido
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_R                                       $5      !0, ->21
          2    > > FE_FETCH_R                                               $5, !1, ->21
    7     3    >   ASSIGN                                                   !2, '%2F%5E%5C%28%28%5B0-9%5D%7B2%7D%29%5C%29+%289%3F%5B0-9%5D%7B4%7D+-+%5B0-9%5D%7B4%7D%29%24%2F'
    9     4        INIT_FCALL                                               'preg_match'
   10     5        SEND_VAR                                                 !2
   11     6        SEND_VAR                                                 !1
    9     7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !3, $7
   15     9      > JMPZ                                                     !3, ->12
   16    10    >   ECHO                                                     'Telefone+Valido%0A'
   15    11      > JMP                                                      ->13
   17    12    >   ECHO                                                     'Telefone+Invalido%0A'
   20    13    >   INIT_FCALL                                               'preg_replace'
   21    14        SEND_VAR                                                 !2
   22    15        SEND_VAL                                                 '%28XX%29+%5C2'
   23    16        CONCAT                                           ~9      !1, '%0A'
         17        SEND_VAL                                                 ~9
   20    18        DO_ICALL                                         $10     
   23    19        ECHO                                                     $10
    5    20      > JMP                                                      ->2
         21    >   FE_FREE                                                  $5
   25    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.99 ms | 1000 KiB | 15 Q