3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = ['âa', 'Bbbbb', 'Éé', 'iou', 'Δδ']; $tests[] = 'ⅷ'; $tests[] = 'Ⅷ'; foreach ($tests as $test) { echo "\n{$test}:"; echo "\n\thasLetterVariants: " , preg_match('~^\p{L&}~u', $test) ? 'yes' : 'no'; echo "\n\tPREG (ext): " , preg_match('~^\p{Lu}~u', $test) ? 'upper' : 'not upper'; echo "\n\tPREG: " , preg_match('~^[\p{Lu}\x{2160}-\x{216F}]~u', $test) ? 'upper' : 'not upper'; echo "\n\tCTYPE: " , ctype_upper(mb_substr($test, 0, 1)) ? 'upper' : 'not upper'; echo "\n\t< a: " , mb_substr($test, 0, 1) < 'a' ? 'upper' : 'not upper'; $chr = mb_substr ($test, 0, 1, "UTF-8"); echo "\n\tMB: " , mb_strtoupper($chr, "UTF-8") == $chr ? 'upper' : 'not upper'; echo "\n\tIntlChar:" , IntlChar::isUUppercase(mb_substr($test, 0, 1)) ? 'upper' : 'not upper'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 100
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 100
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 83
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 97
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 97
Branch analysis from position: 95
Branch analysis from position: 97
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 83
Branch analysis from position: 81
Branch analysis from position: 83
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
Branch analysis from position: 65
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
Branch analysis from position: 53
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
Branch analysis from position: 39
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
Branch analysis from position: 100
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 100
filename:       /in/5kao7
function name:  (null)
number of ops:  102
compiled vars:  !0 = $tests, !1 = $test, !2 = $chr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  '%E2%85%B7'
    5     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  '%E2%85%A7'
    7     5      > FE_RESET_R                                       $6      !0, ->100
          6    > > FE_FETCH_R                                               $6, !1, ->100
    8     7    >   ROPE_INIT                                     3  ~8      '%0A'
          8        ROPE_ADD                                      1  ~8      ~8, !1
          9        ROPE_END                                      2  ~7      ~8, '%3A'
         10        ECHO                                                     ~7
    9    11        ECHO                                                     '%0A%09hasLetterVariants%3A+'
         12        INIT_FCALL                                               'preg_match'
         13        SEND_VAL                                                 '%7E%5E%5Cp%7BL%26%7D%7Eu'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $10     
         16      > JMPZ                                                     $10, ->19
         17    >   QM_ASSIGN                                        ~11     'yes'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~11     'no'
         20    >   ECHO                                                     ~11
   10    21        ECHO                                                     '%0A%09PREG+%28ext%29%3A+'
         22        INIT_FCALL                                               'preg_match'
         23        SEND_VAL                                                 '%7E%5E%5Cp%7BLu%7D%7Eu'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $12     
         26      > JMPZ                                                     $12, ->29
         27    >   QM_ASSIGN                                        ~13     'upper'
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~13     'not+upper'
         30    >   ECHO                                                     ~13
   11    31        ECHO                                                     '%0A%09PREG%3A++++'
         32        INIT_FCALL                                               'preg_match'
         33        SEND_VAL                                                 '%7E%5E%5B%5Cp%7BLu%7D%5Cx%7B2160%7D-%5Cx%7B216F%7D%5D%7Eu'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                         $14     
         36      > JMPZ                                                     $14, ->39
         37    >   QM_ASSIGN                                        ~15     'upper'
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~15     'not+upper'
         40    >   ECHO                                                     ~15
         41        ECHO                                                     '%0A%09CTYPE%3A+++'
         42        INIT_FCALL                                               'ctype_upper'
         43        INIT_FCALL                                               'mb_substr'
         44        SEND_VAR                                                 !1
         45        SEND_VAL                                                 0
         46        SEND_VAL                                                 1
         47        DO_ICALL                                         $16     
         48        SEND_VAR                                                 $16
         49        DO_ICALL                                         $17     
         50      > JMPZ                                                     $17, ->53
         51    >   QM_ASSIGN                                        ~18     'upper'
         52      > JMP                                                      ->54
         53    >   QM_ASSIGN                                        ~18     'not+upper'
         54    >   ECHO                                                     ~18
   12    55        ECHO                                                     '%0A%09%3C+a%3A+++++'
         56        INIT_FCALL                                               'mb_substr'
         57        SEND_VAR                                                 !1
         58        SEND_VAL                                                 0
         59        SEND_VAL                                                 1
         60        DO_ICALL                                         $19     
         61        IS_SMALLER                                               $19, 'a'
         62      > JMPZ                                                     ~20, ->65
         63    >   QM_ASSIGN                                        ~21     'upper'
         64      > JMP                                                      ->66
         65    >   QM_ASSIGN                                        ~21     'not+upper'
         66    >   ECHO                                                     ~21
   14    67        INIT_FCALL                                               'mb_substr'
         68        SEND_VAR                                                 !1
         69        SEND_VAL                                                 0
         70        SEND_VAL                                                 1
         71        SEND_VAL                                                 'UTF-8'
         72        DO_ICALL                                         $22     
         73        ASSIGN                                                   !2, $22
   15    74        ECHO                                                     '%0A%09MB%3A++++++'
         75        INIT_FCALL                                               'mb_strtoupper'
         76        SEND_VAR                                                 !2
         77        SEND_VAL                                                 'UTF-8'
         78        DO_ICALL                                         $24     
         79        IS_EQUAL                                                 !2, $24
         80      > JMPZ                                                     ~25, ->83
         81    >   QM_ASSIGN                                        ~26     'upper'
         82      > JMP                                                      ->84
         83    >   QM_ASSIGN                                        ~26     'not+upper'
         84    >   ECHO                                                     ~26
   17    85        ECHO                                                     '%0A%09IntlChar%3A'
         86        INIT_STATIC_METHOD_CALL                                  'IntlChar', 'isUUppercase'
         87        INIT_FCALL                                               'mb_substr'
         88        SEND_VAR                                                 !1
         89        SEND_VAL                                                 0
         90        SEND_VAL                                                 1
         91        DO_ICALL                                         $27     
         92        SEND_VAR_NO_REF_EX                                       $27
         93        DO_FCALL                                      0  $28     
         94      > JMPZ                                                     $28, ->97
         95    >   QM_ASSIGN                                        ~29     'upper'
         96      > JMP                                                      ->98
         97    >   QM_ASSIGN                                        ~29     'not+upper'
         98    >   ECHO                                                     ~29
    7    99      > JMP                                                      ->6
        100    >   FE_FREE                                                  $6
   18   101      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.4 ms | 1010 KiB | 17 Q