How to Convert the First Character to Uppercase Using PHP?

The PHP function ucfirst() can be used to convert any string to uppercase. The function takes a single parameter, the full path of the string to convert. Here's a code example:

string first letter uppercase php

By Testy TeiraTesty Teira on Jul 03, 2020
<?php
$foo = 'hello world!';
$foo = ucfirst($foo);             // Hello world!

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

Source: www.php.net

Add Comment

9

ucfirst() php

By Ramsey1120Ramsey1120 on Feb 20, 2020
<?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 

Source: www.php.net

Add Comment

10

first character uppercase php

By Zany ZebraZany Zebra on Aug 21, 2020
ucwords("hello world"); // Hello World
ucfirst("hello world"); // Hello world

Add Comment

5

ucfirst

By Mr. SamyMr. Samy on Jun 23, 2020
<?php
/* Convert the first character of "hello" to uppercase:  */
echo ucfirst("hello samy!");

//output : Hello samy!
?>

Add Comment

2

php uppercase first letter

By Mohamed Sami khiariMohamed Sami khiari on Nov 05, 2020
ucfirst($myword);

Add Comment

1

php capitalize first letter

By Concerned ChipmunkConcerned Chipmunk on Apr 05, 2020
ucfirst("hello world!");

Add Comment

2

It is popular in web development, where it controls dynamic content generation, template processing, database access, and web form processing.

PHP answers related to "php uppercase first letter"

View All PHP queries

PHP queries related to "php uppercase first letter"

php uppercase first letter php uppercase each word laravel eloquent get first $tmpmembershipfee = MembershipFee::orderBy('created_at','DESC') ->first(); ?? ' ' operator in php laravel php artisan app:name in laravel 6 php artisan make:auth laravel 8 not working php artisan ui:auth laravel 7 php cache clear in laravel php extensions for laravel php laravel dump php laravel return json response php laravel rount price to 99 php run server laravel php unit testing laravel remove index.php laravel in linux server cheque print in php codeigniter install php ubuntu 20.04 php enable module php display errors php console log php for loop php sha256 php in array php is numeric php now simple localhost php php include once inside a function? php if else how to convert array to string with commas in php curl php example php string to date php string functions Line : 83 -- syntax error, unexpected end of file php php file_put_contents pagination in php php print_r php check if type is mysqli_result saber value ao escolher combobox php Best Code Beautifier tools for php Uncaught TypeError: Argument 1 passed to NotORM_Result::update() php slim array shift php php PDO database connection set default php version in ubuntu php time() spread operator php Check if string starts with php radio button in php form increase PHP Memory login.php php class https//:localhost/phpmyadmin/index.php php get session variable from table Convert string to lowercase in php parseint php Php array length date to string php php reverse shell Mkdir permission denied php Php += Move uploaded file in php Php mysqli fetch assoc Php trying to get property of non-object Php strtolower date format in php array to object in php Send email php smtp hostinger Show all errors in php binemon to php password and confirm password validation in php php int to strin php timeout Php localhost str_pad_left in php php htmlspecialchars php redirect to page

Browse Other Code Languages

CodeProZone