3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regexes = Array( "login" => "/^[A-Za-zÀ-ú0-9._-]{4,16}$/", "mdp" => "/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?])[A-Za-z\d!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?]{7,15}$/", "name" => "/^(?=.*[A-zÀ-ú])[A-zÀ-ú\-\s\']{2,60}$/", "cp" => "/^(?=.*[0-9])[0-9A-z\-\+]{4,20}$/", "long_text" => "/^[A-zÀ-ú\d\-\s@$!%*?&^#°\p{P}]{2,200}$/", "medium_text" => "/^[A-zÀ-ú\d\-\s@$!%*?&^#°\p{P}]{2,150}$/", "short_text" => "/^[A-zÀ-ú\d\-\s@$!%*?&^#°\p{P}]{2,50}$/", "date" => "/^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$/", "time" => "/^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/", "email" => "/^[^\s@]+@[^\s@]+\.[^\s@]+$/" ); $matching_regexes = Array( "login" => "login", "mdp" => "mdp", "nom" => "name", "prenom" => "name", "cp" => "cp", "email" => "email" ); function verifRegex($string, $field_name) { global $regexes, $matching_regexes; return filter_var($string, FILTER_VALIDATE_REGEXP, Array( "options" => Array("regexp" => $regexes[$field_name]) )); } $login = "haaaaa56555555555"; $verif_login = verifRegex($login, "login"); echo $verif_login;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZFZpJ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $regexes, !1 = $matching_regexes, !2 = $login, !3 = $verif_login
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   32     2        ASSIGN                                                   !2, 'haaaaa56555555555'
   34     3        INIT_FCALL                                               'verifregex'
          4        SEND_VAR                                                 !2
          5        SEND_VAL                                                 'login'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !3, $7
   36     8        ECHO                                                     !3
   37     9      > RETURN                                                   1

Function verifregex:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZFZpJ
function name:  verifRegex
number of ops:  14
compiled vars:  !0 = $string, !1 = $field_name, !2 = $regexes, !3 = $matching_regexes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2        BIND_GLOBAL                                              !2, 'regexes'
          3        BIND_GLOBAL                                              !3, 'matching_regexes'
   27     4        INIT_FCALL                                               'filter_var'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 272
   28     7        FETCH_DIM_R                                      ~4      !2, !1
          8        INIT_ARRAY                                       ~5      ~4, 'regexp'
          9        INIT_ARRAY                                       ~6      ~5, 'options'
         10        SEND_VAL                                                 ~6
   27    11        DO_ICALL                                         $7      
   28    12      > RETURN                                                   $7
   30    13*     > RETURN                                                   null

End of function verifregex

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.45 ms | 1088 KiB | 15 Q