Greetings.
I have a problem with how to pass array of byte to PHP. The code:
VB:
Function testbyref(ByRef tes As Variant) As Integer
testbyref = 1
Dim byt(255) As Byte
For i = 0 To 255
byt(i) = i
Next i
tes = byt
End Function
I saved it as class clafr99 in MXOTDLLz.dll and compiled it.
PHP:
<?php
$obj = new COM("MXOTDLLz.clafr99");
$coba = new variant();
$output=$obj->tesbyref($coba);
if($output==1)
{echo("$coba<br>");
$handle=fopen("coba.byr","wb");
$fwrite = fwrite($handle,$coba);
if (!$fwrite) {
return $fwrite;}
}
else
{echo("ERROR");}
?>
The result in file coba.byr is:
A????????????????¦?????????????????????????????????????????????????????????????????????????????????????????????????????????????
This result is same as if i put this code in VB: text1.text = tes
The expected result is:
!"#$%&'()+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¢£¤¥¦§¨©ª«¬*®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
There is something wrong with variant data type in my code. It seems data transfer between Dll/VB to PHP error. Enlight me plz..
I used XAMPP v1.5.1 which contain PHP 5.1.1.1
Regards
Iqbal