在PHP中的vb6 Mid函数

I'm developing a project ,written before in vb6, using PHP.

I have variable called VLSALESITEMID as string

Then a select. (VGID)

Then

VLSALESITEMID=VLSALESITEMID & VGID.field("SALESITEMID").Value & ","

Then

VLSALESITEMID=Mid(VLSALESITEMID, 1, Len(VLSALESITEMID) -1).

I want to translate it to php, any help?

MID FUNCTION :

' 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)

The VB6 Mid function is very similar to PHP's substr function.

<?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 />', "
",
'"', $LastWord, '"<br />', "
",
'"', $MidWords, '"';

Will output:

"Mid"
"Demo"
"Function Demo"