Please, brother elder sister, help me see what's wrong with this program.
Create a user class with "name", "School Number", "Age", "contact phone" Four private attributes that require the assignment of a property "name" through a constructor, and other properties are assigned and accessed through the method. Print out the information for the user "Zhang San", "200440132" "21", "63886666".
Class Message
{
Private $name;
Private $num;
Private $age;
Private $tel;
function __construct ($name, $num, $age, $tel)
{
$this->name= $name;
$this->num= $num;
$this->age= $age;
$this->tel= $tel;
}
function Say ()
{
echo "User:" $this->name "
School Number: "$this->num"
Age: "$this->age"
Tel: "$this->tel;
}
$p =new Message ("Zhang San", 200440132,21,63886666);
$p->say ();
?>
------Solution--------------------
PHP Code
function Say () {echo "User:". $this->name. "
Study Number: ". $this->num."
Age: ". $this->age."
Contact Phone: $this->tel;//There is no use here}} Inside not closed, less curly braces $p=new Message ("Zhang San", 200440132,21,63886666);
------Solution--------------------
Echo User: $this->name. "
Study Number: ". $this->num."
Age: ". $this->age."
Contact Phone: $this->tel;
Note the connector
------Solution--------------------
PHP code
!--? phpclass message{private $name;p rivate $num;p rivate $age;p rivate $tel; function __construct ($name, $num, $age, $tel) {$this--->name= $name; $this->num= $num; $this->age= $age; Tel= $tel;} function say () {echo "User:". $this->name. "
Study Number: ". $this->num."
Age: ". $this->age."
Contact Phone: $this The->tel;//variable is used with the string's Connector.}} Write less one} $p =new Message ("Zhang San", 200440132,21,63886666); $p->say ();?
------Solution--------------------
Thank you for a half-day non-stick