Page 1 of 1

Array Object

Posted: Thu Jan 31, 2013 4:31 am
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.

Re: Array Object

Posted: Thu Jan 31, 2013 10:50 am
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";
}

Re: Array Object

Posted: Thu Jan 31, 2013 4:45 pm
by spacebiscuit
That's great, worked perfectly - thank you.