3
I have this function in ASP and need to convert to PHP
DICE:
cod = "01A" ou cod = "01B" ou cod = "01C"
titulo = "Novidade"
FUNCTION:
letra = right(cod,1)
str = array("A","B","C")
for i = lBound(str) to ubound(str)
if (instr(1,letra,str(i),vbtextcompare) <> 0) then
titulo = titulo & "-" & i+2
end if
next
RESULT:
se cod="01A" então titulo = "Novidade-1"
se cod="01B" então titulo = "Novidade-2"
se cod="01C" então titulo = "Novidade-3"
Thank you all for your help
rray, I thank you, I give you more details: The array contains only letters (complete alphabet from A to Z). COD are nna (2 numbers and 1 letter). The function compares the COD letter and increments the title to '-1' if it is letter A; '-2' if it is letter B so on. I hope I have clarified, qq doubt post. Thank you.
– Geo
I forgot to inform the most important. Before the function has; letter=right(Cod,1) here is separated the letter of Cod for the function compare. sorry the fault.
– Geo
@Geo then you compare only if the letters are equal and then make the increment?
– rray
that’s right. for example COD=23B the title is = novelty-2
– Geo
@Geo edited the answer see if it’s correct now.
– rray