3v4l.org

run code in 500+ PHP versions simultaneously
<?php $lookup = ['neither', 'upper', 'lower']; $tests = ['A', 'z', '+', '0', 'ǻ', 'Ͱ', null]; foreach ($tests as $test) { $index = preg_match('~(\p{Lu})|(\p{Ll})~u', $test, $out) ? array_key_last($out) : 0; echo "{$test}: {$lookup[$index]}\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/ldgHN
function name:  (null)
number of ops:  26
compiled vars:  !0 = $lookup, !1 = $tests, !2 = $test, !3 = $index, !4 = $out
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    3     1        ASSIGN                                                       !1, <array>
    5     2      > FE_RESET_R                                           $7      !1, ->24
          3    > > FE_FETCH_R                                                   $7, !2, ->24
    6     4    >   INIT_FCALL                                                   'preg_match'
          5        SEND_VAL                                                     '%7E%28%5Cp%7BLu%7D%29%7C%28%5Cp%7BLl%7D%29%7Eu'
          6        SEND_VAR                                                     !2
          7        SEND_REF                                                     !4
          8        DO_ICALL                                             $8      
          9      > JMPZ                                                         $8, ->15
         10    >   INIT_FCALL                                                   'array_key_last'
         11        SEND_VAR                                                     !4
         12        DO_ICALL                                             $9      
         13        QM_ASSIGN                                            ~10     $9
         14      > JMP                                                          ->16
         15    >   QM_ASSIGN                                            ~10     0
         16    >   ASSIGN                                                       !3, ~10
    7    17        ROPE_INIT                                         4  ~14     !2
         18        ROPE_ADD                                          1  ~14     ~14, '%3A+'
         19        FETCH_DIM_R                                          ~12     !0, !3
         20        ROPE_ADD                                          2  ~14     ~14, ~12
         21        ROPE_END                                          3  ~13     ~14, '%0A'
         22        ECHO                                                         ~13
    5    23      > JMP                                                          ->3
         24    >   FE_FREE                                                      $7
    8    25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.53 ms | 2222 KiB | 15 Q