hrtehnolog Posted October 12, 2013 Share Posted October 12, 2013 Hi! php code copied form the book Begining php and MySQL (Apress) will not print: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <?php class Book { // definicija polja private $title; private $isbn; private $copies; // konstruktor public function _construct($isbn) { $this->setIsbn($isbn); $this->getTitle(); $this->getNumberCopies(); } public function setIsbn($isbn) { $this->isbn = $isbn; } public function getTitle() { $this->title = "Beginning Python"; print "Title: ".$this->title."<br />"; } public function getNumberCopies() { $this->copies = "5"; print "Number copies available: ".$this->copies."<br />"; } } $book = new book("159059519X"); ?> </body> </html> Tried it on Turnkey LAMP and 000webhost, on several major browsers. Is something wrong? Thanks Link to comment https://forums.phpfreaks.com/topic/282912-php-code-wont-print/ Share on other sites More sharing options...
kicken Posted October 12, 2013 Share Posted October 12, 2013 public function _construct($isbn) That should be: public function __construct($isbn) There are supposed to be two underscores in front. Link to comment https://forums.phpfreaks.com/topic/282912-php-code-wont-print/#findComment-1453656 Share on other sites More sharing options...
hrtehnolog Posted October 12, 2013 Author Share Posted October 12, 2013 works now thanks a lot Link to comment https://forums.phpfreaks.com/topic/282912-php-code-wont-print/#findComment-1453657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.