How to pass objects in php function
This is the simple way to pass object in php function .Before run these codes you should aware of following files. 1. Khunt.php :- This is the main class file. 2. ReqMsgDTO.php :- This file have setter and getter properties. 3. Sale.html :- This file basically provides the User Interface along with Order Id and Mid. 4. test.php :- This file will invoke the generateTrnReqMsg($object) along with pass object . 1. Khunt.php <?php include("ReqMsgDTO.php"); class Khunt { function generateTrnReqMsg($reqMsgDTO) { try { if ($reqMsgDTO == null || $reqMsgDTO->Mid == null || $reqMsgDTO->Mid == "" || $reqMsgDTO->OrderId == null || $reqMsgDTO->OrderId == "" ) {