A VBScript equivalent of PHP’s array_unshift
Function array_unshift(ByRef mAry, ByVal mVal)
Dim intCounter
Dim intElementCount
If IsArray(mAry) Then
If IsArray(mVal) Then
ret = array_push(mVal,mAry)
mAry = mVal
Else
ReDim Preserve mAry(UBound(mAry) + 1)
For intCounter = UBound(mAry) to 1 Step -1
mAry(intCounter) = mAry(intCounter -1)
Next
mAry(0) = mVal
End If
Else
If IsArray(mVal) Then
mAry = mVal
Else
mAry = Array(mVal)
End If
End If
array_unshift = UBound(mAry)
End Function
Please also note that php.vbs offers community built functions and goes by the McDonald’s Theory. We’ll put online functions that are far from perfect, in the hopes to spark better contributions. Do you have one? Then please just: