note 104660 added to class.dotnet

From: Date: Wed, 29 Jun 2011 09:57:44 +0000
Subject: note 104660 added to class.dotnet
Groups: php.notes 
Request: Send a blank email to php-notes+get-181032@lists.php.net to get a copy of this message
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; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 59.162.74.111 ---- Manual Page -- http://www.php.net/manual/en/class.dotnet.php Edit -- https://master.php.net/note/edit/104660 Del: integrated -- https://master.php.net/note/delete/104660/integrated Del: useless -- https://master.php.net/note/delete/104660/useless Del: bad code -- https://master.php.net/note/delete/104660/bad+code Del: spam -- https://master.php.net/note/delete/104660/spam Del: non-english -- https://master.php.net/note/delete/104660/non-english Del: in docs -- https://master.php.net/note/delete/104660/in+docs Del: other reasons-- https://master.php.net/note/delete/104660 Reject -- https://master.php.net/note/reject/104660 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181032) next »