fork(1) download
  1. <?php
  2. $first_comment = new stdClass;
  3. $first_comment->cid = '10';
  4. $first_comment->message = 'this is the first message';
  5. $first_comment->parent = '0';
  6.  
  7. $second_comment = new stdClass;
  8. $second_comment->cid = '20';
  9. $second_comment->message = 'this is the second message';
  10. $second_comment->parent = '0';
  11.  
  12. $third_comment = new stdClass;
  13. $third_comment->cid = '30';
  14. $third_comment->message = 'this is a reply to the first message';
  15. $third_comment->parent = '10';
  16.  
  17. $comments = array ($first_comment, $second_comment, $third_comment);
  18.  
  19. //print_r($comments);
  20.  
  21. foreach ( $comments as $c ) {
  22. echo "#". $c->cid . " ". $c->message . "\n\n";
  23. }
  24. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
#10  this is the first message

#20  this is the second message

#30  this is a reply to the first message