我正在使用PHP开发一个在vb6之前编写的项目。
我有一个名为VLSALESITEMID的变量作为字符串
然后选择。 (VGID)
然后
VLSALESITEMID=VLSALESITEMID & VGID.field("SALESITEMID").Value & ","
然后
VLSALESITEMID=Mid(VLSALESITEMID, 1, Len(VLSALESITEMID) -1).
我想把它翻译成php,有什么帮助吗?
MID功能:
' Creates text string.
Dim TestString As String = "Mid Function Demo"
' Returns "Mid".
Dim FirstWord As String = Mid(TestString, 1, 3)
' Returns "Demo".
Dim LastWord As String = Mid(TestString, 14, 4)
' Returns "Function Demo".
Dim MidWords As String = Mid(TestString, 5)
答案 0 :(得分:0)
VB6 Mid函数与PHP的substr函数非常相似。
<?php
// Creates text string.
$TestString = 'Mid Function Demo';
// Returns "Mid".
$FirstWord = substr($TestString, 0, 3);
// Returns "Demo".
$LastWord = substr($TestString, 13, 4);
// Returns "Function Demo".
$MidWords = substr($TestString, 4);
echo
'"', $FirstWord, '"<br />', "\n",
'"', $LastWord, '"<br />', "\n",
'"', $MidWords, '"';
将输出:
“Mid”
“Demo”
“功能演示”