A question: Are you writing code using new features?
Settings passed in Parameters, and return values of outgoing parameters<div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">class Person(){
public function name(string $name):string {
return "名称:".$name;
}
public function age(int $age):string {
return "年龄:".$age;
}}</pre><div class="contentsignin">Copy after login</div></div>
class Address(){ public function getAddress(int $age):string { return ['street'=>'street1','country'=>'china']; }}class Person(){ public function name(string $name):string { return "名称:".$name; } public function age(int $age):string { return "年龄:".$age; } public function age(int $age):Address { return new Address(); }}
The above is the detailed content of About scalar type and return value type declaration in PHP7. For more information, please follow other related articles on the PHP Chinese website!