3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vBase = [ 'properName' => function($value) { return (bool)preg_match('/^([A-ZА-Я]{1}[A-Za-zА-Яа-я]+){1}([\-\s]{1}[A-ZА-Я]{1}[A-Za-zА-Яа-я]+)*$/', $value); }, ]; $tests = [ 'Коломиец-Московская', 'Петр Могила', 'Nikita', 'Philipp Gopkalo', 'test 12', '12test', 'test12', 'alex' ]; foreach ($tests as $test) { print_r( [ 'value' => $test, 'isValidFormat' => $vBase['properName']($test), ] ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/p5CVn
function name:  (null)
number of ops:  18
compiled vars:  !0 = $vBase, !1 = $tests, !2 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fp5CVn%3A5%240'
    7     1        INIT_ARRAY                                       ~4      ~3, 'properName'
    4     2        ASSIGN                                                   !0, ~4
   10     3        ASSIGN                                                   !1, <array>
   21     4      > FE_RESET_R                                       $7      !1, ->16
          5    > > FE_FETCH_R                                               $7, !2, ->16
   22     6    >   INIT_FCALL                                               'print_r'
   24     7        INIT_ARRAY                                       ~8      !2, 'value'
   25     8        FETCH_DIM_R                                      ~9      !0, 'properName'
          9        INIT_DYNAMIC_CALL                                        ~9
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0  $10     
         12        ADD_ARRAY_ELEMENT                                ~8      $10, 'isValidFormat'
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                                 
   21    15      > JMP                                                      ->5
         16    >   FE_FREE                                                  $7
   28    17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fp5CVn%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p5CVn
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5E%28%5BA-Z%D0%90-%D0%AF%5D%7B1%7D%5BA-Za-z%D0%90-%D0%AF%D0%B0-%D1%8F%5D%2B%29%7B1%7D%28%5B%5C-%5Cs%5D%7B1%7D%5BA-Z%D0%90-%D0%AF%5D%7B1%7D%5BA-Za-z%D0%90-%D0%AF%D0%B0-%D1%8F%5D%2B%29%2A%24%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        BOOL                                             ~2      $1
          6      > RETURN                                                   ~2
    7     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fp5CVn%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.38 ms | 1396 KiB | 17 Q