VBScript array function

A VBScript equivalent of PHP’s array


Sub [](ByRef mAry, ByVal mVal)

    If IsArray(mAry) Then
        Dim counter : counter = UBound(mAry) + 1
        ReDim Preserve mAry(counter)
        mAry(counter) = mVal
    Else
        mAry = Array(mVal)
    End If

End Sub

Please note that php.vbs uses VB Script objects as substitutes for PHP arrays, they are the closest match to this hashtable-like data structure.

Other PHP functions in the array extension