pthurmond Posted July 19, 2007 Share Posted July 19, 2007 I am trying to clean up my class to be more readable. Currently each property (aka variable) is declared on separate lines. Example: class user { private $item; private $thing; private $whatever; //etc } Is is valid to instead write it like this?: class user { private $item, $thing, $whatever; //etc } This is roughly what is done in C++, with some minor differences since the variable type is declared as well. Also I want to know if PHP allows function prototypes like C++ does. This is where you declare the function in the class and the list of possible parameters and then you define the functions either in another file or directly below the class in the same file. Can this be done in PHP as well? Thanks, Patrick Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 20, 2007 Share Posted July 20, 2007 I'm afraid you can't do that. Quote Link to comment Share on other sites More sharing options...
trq Posted July 20, 2007 Share Posted July 20, 2007 his is where you declare the function in the class and the list of possible parameters and then you define the functions either in another file or directly below the class in the same file. Not really what your looking for but you may want to look into abstraction or even using interfaces. As for this... private $item, $thing, $whatever; Did you try it? Its valid. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.