Below you'll find the source for the Visual Basic 6 function array_reverse.
Attribute VB_Name = "modArrayReverse"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
'
' You may freely distribute this file but please leave all comments, including this one, in it.
'
' @Author Stefan Thoolen <mail@stefanthoolen.nl>
Option Explicit
''
' Return an array with elements in reverse order
' See also: http://www.php.net/manual/en/function.array-reverse.php
' Difference with the PHP equavelent is the preserve_keys-parameter and we use the array by reference
' @param array arr The input array
' @return boolean Returns TRUE on success or FALSE on failure
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function array_reverse(ByRef arr As Variant) As Boolean
On Error GoTo array_reverse_error
If LBound(arr) = UBound(arr) Then Exit Function
On Error GoTo 0
' Copy the whole array so keys are created and types are copied
Dim tmp As Variant
tmp = arr
Dim i As Integer
For i = LBound(arr) To UBound(arr)
arr(UBound(arr) - i + LBound(arr)) = tmp(i)
Next i
array_reverse = True
array_reverse_error:
End Function