mukul.ssca Posted December 12, 2006 Share Posted December 12, 2006 Hi, I'm new to php. Can any one can tell me how to pass a class as a function parameter?Thanks & Regards Mukul Chaudhurimukul.ssca@gmail.com Link to comment Share on other sites More sharing options...
justsomeguy Posted December 12, 2006 Share Posted December 12, 2006 Do you mean passing an instance of a class, or passing the class itself? Link to comment Share on other sites More sharing options...
mukul.ssca Posted December 13, 2006 Author Share Posted December 13, 2006 Yes both. I don't know if it can be done at all or not. Another question: Does PHP support pointers?Mukul Chaudhuri Link to comment Share on other sites More sharing options...
reportingsjr Posted December 13, 2006 Share Posted December 13, 2006 I dont know what you are talking about, steve does though. No their are no pointers in php though. Im pretty sure those are only supported in C and C++. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 13, 2006 Share Posted December 13, 2006 you can pass an instance of a class, it is just variable/object, not sure about passing the class itself though. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 13, 2006 Share Posted December 13, 2006 Yeah, I doubt you can pass the class definition or something like that. You could pass the class name as a string, but even then I don't think you can create a new object of that class. However, passing an instance of the class is the same as passing any other variable like aspnetguy said.As far as pointers, PHP does not have pointers the same way C does, but you can refer to things by reference.http://www.php.net/manual/en/language.references.php Link to comment Share on other sites More sharing options...
mukul.ssca Posted December 15, 2006 Author Share Posted December 15, 2006 It worked!!! Thanks to all for your guidance and suggestions.Mukul Chaudhuri Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now