Converting Array Values to Upper Case in PHP


Convert all string values in an array to uppercase with array_map() and strtoupper.

Source Code

$fruits = ["apple", "banana", "cherry"];
$upperFruits = array_map("strtoupper", $fruits);
print_r($upperFruits); // Outputs array with uppercase values
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments