Ask elder sister to help little brother I look at this program what is wrong

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.