0
0
PHPprogramming~10 mins

Case conversion functions in PHP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to convert the string to uppercase.

PHP
<?php
$text = "hello world";
echo [1]($text);
?>
Drag options to blanks, or click blank then click option'
Aucwords
Bstrtolower
Cstrtoupper
Ducfirst
Attempts:
3 left
💡 Hint
Common Mistakes
Using strtolower which converts to lowercase.
Using ucfirst which only capitalizes the first letter.
2fill in blank
medium

Complete the code to convert the string to lowercase.

PHP
<?php
$text = "HELLO WORLD";
echo [1]($text);
?>
Drag options to blanks, or click blank then click option'
Astrtolower
Bucfirst
Cstrtoupper
Ducwords
Attempts:
3 left
💡 Hint
Common Mistakes
Using strtoupper which converts to uppercase.
Using ucfirst which only capitalizes the first letter.
3fill in blank
hard

Fix the error in the code to capitalize the first letter of each word.

PHP
<?php
$text = "hello world";
echo [1]($text);
?>
Drag options to blanks, or click blank then click option'
Astrtoupper
Bucwords
Cstrtolower
Ducfirst
Attempts:
3 left
💡 Hint
Common Mistakes
Using ucfirst which only capitalizes the first letter of the whole string.
Using strtoupper which makes all letters uppercase.
4fill in blank
hard

Fill both blanks to convert the string to lowercase and then capitalize the first letter.

PHP
<?php
$text = "HELLO WORLD";
$lower = [1]($text);
$result = [2]($lower);
echo $result;
?>
Drag options to blanks, or click blank then click option'
Astrtolower
Bucwords
Cucfirst
Dstrtoupper
Attempts:
3 left
💡 Hint
Common Mistakes
Using strtoupper instead of strtolower first.
Using ucwords instead of ucfirst for the second step.
5fill in blank
hard

Fill all three blanks to convert the string to lowercase, then capitalize the first letter of each word, and finally convert the whole string to uppercase.

PHP
<?php
$text = "hello world";
$lower = [1]($text);
$capitalized = [2]($lower);
$upper = [3]($capitalized);
echo $upper;
?>
Drag options to blanks, or click blank then click option'
Aucfirst
Bstrtolower
Cucwords
Dstrtoupper
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of functions.
Using ucfirst instead of ucwords for capitalizing each word.