Reversing Array Order

by Feb 4, 2009

To reverse the order of elements in an array, the most efficient way is to use the [Array] type and its static method Reverse():

# Create an array containing text and output contents:
$a = ipconfig
$a
# Reverse array contents and then output it again:
[array]::Reverse($a)
$a