3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ufirst( $str ) { $octetCode = ord( $str ); // See https://en.wikipedia.org/wiki/ASCII#Printable_characters if ( $octetCode < 96 ) { // Assume this is an uppercase/uncased ASCII character return (string)$str; } elseif ( $octetCode < 128 ) { // Assume this is a lowercase/uncased ASCII character return ucfirst( $str ); } $first = mb_substr( $str, 0, 1 ); return ( strlen( $first ) !== 1 ) // Assume this is a multibyte character and mb_internal_encoding() is appropriate ? mb_strtoupper( $first ) . mb_substr( $str, 1 ) // Assume this is a non-multibyte character and LC_CASE is appropriate : ucfirst( $str ); } $str = "ალევის_სამების_მონასტერი.jpg"; $str = ufirst($str); echo $str; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lo6ro
function name:  (null)
number of ops:  7
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, '%E1%83%90%E1%83%9A%E1%83%94%E1%83%95%E1%83%98%E1%83%A1_%E1%83%A1%E1%83%90%E1%83%9B%E1%83%94%E1%83%91%E1%83%98%E1%83%A1_%E1%83%9B%E1%83%9D%E1%83%9C%E1%83%90%E1%83%A1%E1%83%A2%E1%83%94%E1%83%A0%E1%83%98.jpg'
   22     1        INIT_FCALL                                               'ufirst'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   23     5        ECHO                                                     !0
   24     6      > RETURN                                                   1

Function ufirst:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lo6ro
function name:  ufirst
number of ops:  41
compiled vars:  !0 = $str, !1 = $octetCode, !2 = $first
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'ord'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    5     5        IS_SMALLER                                               !1, 96
          6      > JMPZ                                                     ~5, ->10
    7     7    >   CAST                                          6  ~6      !0
          8      > RETURN                                                   ~6
          9*       JMP                                                      ->16
    8    10    >   IS_SMALLER                                               !1, 128
         11      > JMPZ                                                     ~7, ->16
   10    12    >   INIT_FCALL                                               'ucfirst'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15      > RETURN                                                   $8
   13    16    >   INIT_FCALL                                               'mb_substr'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 0
         19        SEND_VAL                                                 1
         20        DO_ICALL                                         $9      
         21        ASSIGN                                                   !2, $9
   14    22        STRLEN                                           ~11     !2
         23        IS_NOT_IDENTICAL                                         ~11, 1
         24      > JMPZ                                                     ~12, ->35
   16    25    >   INIT_FCALL                                               'mb_strtoupper'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $13     
         28        INIT_FCALL                                               'mb_substr'
         29        SEND_VAR                                                 !0
         30        SEND_VAL                                                 1
         31        DO_ICALL                                         $14     
         32        CONCAT                                           ~15     $13, $14
         33        QM_ASSIGN                                        ~16     ~15
         34      > JMP                                                      ->39
   18    35    >   INIT_FCALL                                               'ucfirst'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $17     
         38        QM_ASSIGN                                        ~16     $17
         39    > > RETURN                                                   ~16
   19    40*     > RETURN                                                   null

End of function ufirst

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.3 ms | 1413 KiB | 22 Q