3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r = '/^[А-Я]{1}[0-9]{3}[А-Я]{2}[0-9]{3}$/u'; $pattern = 'Я000ЯЯ000'; $check = function ($str) use ($r, $pattern) { return (bool) preg_match($r, $str . mb_substr($pattern, mb_strlen($str))); }; foreach (['ББ12', 'И7'] as $test) { echo json_encode([$test, $check($test)], JSON_UNESCAPED_UNICODE), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/5HCrV
function name:  (null)
number of ops:  22
compiled vars:  !0 = $r, !1 = $pattern, !2 = $check, !3 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%5E%5B%D0%90-%D0%AF%5D%7B1%7D%5B0-9%5D%7B3%7D%5B%D0%90-%D0%AF%5D%7B2%7D%5B0-9%5D%7B3%7D%24%2Fu'
    4     1        ASSIGN                                                   !1, '%D0%AF000%D0%AF%D0%AF000'
    5     2        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          3        BIND_LEXICAL                                             ~6, !0
          4        BIND_LEXICAL                                             ~6, !1
          5        ASSIGN                                                   !2, ~6
    9     6      > FE_RESET_R                                       $8      <array>, ->20
          7    > > FE_FETCH_R                                               $8, !3, ->20
   10     8    >   INIT_FCALL                                               'json_encode'
          9        INIT_ARRAY                                       ~9      !3
         10        INIT_DYNAMIC_CALL                                        !2
         11        SEND_VAR_EX                                              !3
         12        DO_FCALL                                      0  $10     
         13        ADD_ARRAY_ELEMENT                                ~9      $10
         14        SEND_VAL                                                 ~9
         15        SEND_VAL                                                 256
         16        DO_ICALL                                         $11     
         17        ECHO                                                     $11
         18        ECHO                                                     '%0A'
    9    19      > JMP                                                      ->7
         20    >   FE_FREE                                                  $8
   11    21      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5HCrV
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $str, !1 = $r, !2 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    6     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAR                                                 !1
          5        INIT_FCALL                                               'mb_substr'
          6        SEND_VAR                                                 !2
          7        INIT_FCALL                                               'mb_strlen'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
         12        CONCAT                                           ~5      !0, $4
         13        SEND_VAL                                                 ~5
         14        DO_ICALL                                         $6      
         15        BOOL                                             ~7      $6
         16      > RETURN                                                   ~7
    7    17*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
482.71 ms | 1008 KiB | 17 Q