immanuelx2 Posted July 25, 2009 Share Posted July 25, 2009 For example: class Post { function __construct() {} function getRelatedPosts() { // get related posts through query while ($post = mysql_fetch_assoc($query)) { $post = new Post(); $post->getTitle; } } } Reason I ask is that I am having trouble getting it to output anything using the getRelated type function. Or is there a better way of trying to accomplish something like this? Quote Link to comment https://forums.phpfreaks.com/topic/167425-solved-can-an-object-create-itself/ Share on other sites More sharing options...
ignace Posted July 25, 2009 Share Posted July 25, 2009 An object can contain an instance(s) of itself. Quote Link to comment https://forums.phpfreaks.com/topic/167425-solved-can-an-object-create-itself/#findComment-882846 Share on other sites More sharing options...
immanuelx2 Posted July 25, 2009 Author Share Posted July 25, 2009 Thanks. I realized I wasn't calling the damn functions right forgot the trailing () Quote Link to comment https://forums.phpfreaks.com/topic/167425-solved-can-an-object-create-itself/#findComment-882879 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.