Array Object

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Array Object

Post by spacebiscuit »

Hi,

I'm trying to work with an array object, I want to make the data in each index uppercase, I can output the data to screen but how do I change values.

Code: Select all

foreach ($order->delivery as $key => $value) {
    print "$key => $value\n";
}
Thank you.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Array Object

Post by Christopher »

Code: Select all

foreach ($order->delivery as $key => $value) {
    $order->delivery[$key] = strtoupper($value);
}
foreach ($order->delivery as $key => $value) {
    print "$key => $value\n";
}
(#10850)
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Re: Array Object

Post by spacebiscuit »

That's great, worked perfectly - thank you.
Post Reply