Hello Everybody,
Can anybody please convert the following code (which is in Vš to PHP.
I would be very thankful for it.
Public Function genratekey(serialkey As String, emailkey As String) As String
' declaring an array to store the email characters.
Dim emailarray(100) As String
Dim i As Integer
'serialkey = SerialTxt.text
'emailkey = Email.text
'Taking the email array converting to a number...
'for loop for recursively storing the characters in the email and converting it into a number using a number conversion function..
'this can be any function which takes in a character and then outputs a number
For i = 0 To Len(emailkey)
emailarray(i) = chartonum(Mid$(emailkey, 1))
Next
Dim emailnumber As Double
'multiplying all numbers with an incrementing number for enumeration and prime key generation
emailnumber = 1
For i = 0 To Len(emailkey)
emailnumber = emailnumber + (CDbl(emailarray(i)) * i)
Next
Dim serialarray, serialx
'split function takes an input string and then converts it into an array using the delimeter
'assume the serial key is XYZ1-1234-1234-1234 then split will make an array of 4 strings.. the - is the delimeter
serialarray = Split(serialkey, "-")
'asc function for getting the ascii value of the first array which is a alphabetic code
serialarray(0) = CStr(Asc(serialarray(0)))
serialx = serialarray(1) + serialarray(2) + serialarray(3)
Dim finalNumber As Double
finalNumber = emailnumber CDbl(serialarray(0)) + (emailnumber + 50) _
CDbl(serialarray(1)) + (emailnumber + 150) CDbl(serialarray(2)) + (emailnumber + 200) CDbl(serialarray(3))
Dim finaltxt As String
finaltxt = CLng(finalNumber) emailnumber + (serialx + 12546874592#) 950
finaltxt = Mid$(finaltxt, 1, 12)
finaltxt = Mid$(finaltxt, 3, 1) & Mid$(finaltxt, 2, 1) & Mid$(finaltxt, 1, 6) & Mid$(finaltxt, 7, 1) & Mid$(finaltxt, 7, 6) & Mid$(finaltxt, 11, 1)
Dim ftxt As String
ftxt = Mid$(finaltxt, 1, 4) & "-" & Mid$(finaltxt, 5, 4) & "-" & Mid$(finaltxt, 9, 4) & "-" & Mid$(finaltxt, 13, 4)
genratekey = ftxt
'finaltxt is the 16 digit number for the final code..
End Function
=============================================
Any Help would be really appreciated.
Regards
San Trino