fork download
  1. <?php
  2.  
  3. class Preview
  4. {
  5.  
  6. private $id;
  7.  
  8. function __construct($id) {
  9. $this->id = $id;
  10. }
  11.  
  12. function show()
  13. {
  14. echo $this->id.' ';
  15. }
  16.  
  17. }
  18.  
  19. for ($i = 0; $i < 4; $i++){
  20. $preview = new Preview($i);
  21. $preview->show();
  22. }
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
0 1 2 3