fork download
  1. <?php
  2.  
  3. class Book {
  4. function __construct() { }
  5.  
  6. public static function withDescriptors($isNotOrmObject, $isArray, $isScalar) {
  7. $instance = new self();
  8. // initialization here
  9. return $instance;
  10. }
  11. }
  12.  
  13. $isNotORMobject = new stdclass;
  14. $isArray = [1, 2, 'skip a few', 99, 100];
  15. $isScalar = 42;
  16.  
  17. $book = Book::withDescriptors($isNotORMobject, $isArray, $isScalar);
  18.  
  19. echo "see?\n";
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
see?