but can you teach me how?
i have VB code as below, can you parse it and trans to php code?
tks
datalen = HexT(str1, data(), 0)
Function HexT(ip_str As String, op_str() As Byte, op_start As Integer) As Integer
'translate String to Hex by byte.
'can setting output start position; ret=byte array tail
Dim Start As Integer, Cnt As Integer
Dim tmpstr As String
Dim data As Integer
Start = 1
Cnt = 0 + op_start
Do
tmpstr = Mid$(ip_str, Start, 1)
Start = Start + 1
If tmpstr = "" Then Exit Do
If tmpstr = "\" Then
tmpstr = "&H" & Mid$(ip_str, Start, 2)
Start = Start + 2
op_str(Cnt) = Val(tmpstr)
Cnt = Cnt + 1
Else
data = Asc(tmpstr)
op_str(Cnt) = data Mod 256
Cnt = Cnt + 1
If data >= 256 Then
op_str(Cnt) = data / 256
Cnt = Cnt + 1
End If
End If
Loop
HexIpB = Cnt
End Function