In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Method 1:
Class Person {
Var $name
Var $sex
Var $age
Function say () {
Echo "this person is talking"; / / if echo is not written here, write return "this person is talking"; and when calling, write echo $person1- > say
}
Function run () {
Echo, "this man is walking."
}
}
$person1=new person ()
$person2=new person ()
$person1- > name= "Zhang San"
$person1- > sex= "female"
Echo $person1- > name
Echo ""
Echo $person1- > sex
$person1- > say (); / / because echo has already been written in function, it is directly referenced here (that is, $person1- > say ();)
Method 2: (access by private members)
Class Person {
Private $name
Private $sex
Private $age
Public function _ _ set ($name,$value) {/ / function is followed by two underscores with a space between them
Return $this- > $name=$value
}
Public function _ _ get ($name) {
Return $this- > $name
}
}
$person1= new person ()
$person2= new person ()
$person1- > name= "Zhang San"
Echo $person1- > name; / / if you have already written echo in function, just write $person1- > name here
$person1- > sex= "40"
Echo $person1- > sex
? >
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.