L'instance d'objet ne s'affiche pas
Bonjour,
Je fais un exercice qui me dis que le résultat de ce code doit être un tableau HTML dans lequel le texte affiché serait Custom text. Mais moi je vois un tableau avec My text.
Quelqu'un saurait-il de quoi cela vient ?
Voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?php
class TextBox {
var $body_text = "my text";
// Constructor function
function __construct($text_in) {
$this->body_text = $text_in;
}
function display() {
print("<TABLE BORDER=1><TR><TD>$this->body_text");
print("</TD></TR></TABLE>");
}
}
// creating an instance
$box = new TextBox("custom text");
$box->display();
?> |