function myFunction($stdObj){ echo $stdObj->name.""; } $a= new stdClass; $a->name = "Ramesh Song"; $a->email = "ilovephp@gmail.com"; $a->web = "phpbuddy.blogsport.com"; myFunction($a); // output : Ramesh Song /******** Other Way ********/ $b = array( "name" => "Ramesh song", "email" => "ilovephp@gmail.com", "web" => "phpbuddy.blogsport.com"); $b = (object) $b; myFunction($b); // output : Ramesh Song
0 comments:
Post a Comment