Jump to content

php code won't print


hrtehnolog

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.