looping through the array in a reverse manner or reverse foreach in php

$array = array(‘foo’ => ‘bar’, ‘baz’, ‘bat’ => 2);
end($array);
while (key($array) !== null) {
echo key($array) .”: ” .current($array) . PHP_EOL;
prev($array);
}

2 thoughts on “looping through the array in a reverse manner or reverse foreach in php

  1. Hello, probably our posting might be off topic but anyways, Having gone browsing around your blog and it seems very professional. It is obvious that you know the subject and you seem fervent about it. I’m creating a fresh web site and I am struggling to make it look good, and provide high quality subject matter. I have acquired much at your web site and also I anticipate even more quality information and will be back soon. Thanks you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s