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; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Ალევის_სამების_მონასტერი.jpg

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
30.28 ms | 401 KiB | 8 Q