capital letter php code example

Example 1: php string to uppwe

$lowercase = "this is lower case";
$uppercase = strtoupper($lowercase);

echo $uppercase;
// THIS IS LOWER CASE

Example 2: string first letter uppercase php

<?php
$foo = 'hello world!';
$foo = ucfirst($foo);             // Hello world!

$bar = 'HELLO WORLD!';
$bar = ucfirst($bar);             // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>

Example 3: ucfirst() php

<?php
$foo = 'hello world!';
$foo = ucfirst($foo);             // Hello world!

$bar = 'HELLO WORLD!';
$bar = ucfirst($bar);             // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
// string manipulation function

Example 4: php uppercase first letter

ucfirst($myword);

Example 5: php code to convert to small letter

$str = strtolower($str);

Tags:

Php Example