exercise to try different type of method signature and calling them in php.
VB.net Code
Public Class Class1
Public Function SayHello(ByVal input As String) As String
Return "Php input: " & input & "</BR>Dot net library said- 'Hello'"
End Function
Public Function ConcatArray(ByVal Values As Object()) As String
Dim ret As String = String.Empty
For Each sval As Object In Values
ret = ret & sval.ToString & " "
Next
Return ret.Substring(1, ret.Length - 1)
End Function
Public Function ReturnObject(ByVal FirstName As String, ByVal LastName As String) As Name
Dim obj As New Name
obj.FirstName = FirstName
obj.LastName = LastName
Return obj
End Function
'To explain Byref doesn't work with php
Public Function CallByRef(ByRef value As String) As String
value = "Value to ByRef parameter set in dot net."
Return "ByRef CallByRef() method called."
End Function
End Class
Public Class Name
Public FirstName As String = String.Empty
Public LastName As String = String.Empty
End Class
Php code to test .net library
<?php
$class1 = new DOTNET("DotNetTest,"
."Version=1.0.0.0,"
."Culture=neutral,"
."PublicKeyToken=6675daefc27eafc4"
,"DotNetTest.Class1");
echo $class1->SayHello("Hi PHP!!!!");
echo "</P>";
$parameter[0] = 12345;
$parameter[1] = "MyString";
$parameter[2] = false;
$ret = $class1 -> ConcatArray($parameter);
echo $ret;
echo "</P>";
$Obj = $class1 -> ReturnObject("Sandip","Shimpi");
echo $Obj->FirstName." ".$Obj->LastName;
echo "</P>";
$myByRef = "";
echo "Value of ByRef Variable before calling .net CallByRef() method: ".$myByRef;
echo "</BR>";
echo $class1 -> CallByRef($myByRef);
echo "</BR>";
echo "Now value of ByRef Variable: ".$myByRef;
echo $myByRef;
?>