java软件工程师学php -11.函数

WBOY
Release: 2016-06-13 13:11:34
Original
761 people have browsed it

java程序员学php -11.函数

public String join(String head, String body){
    if(body == null) body = "Nobody";
    return head + body;
}
Copy after login



function join(head, body='Nobody'){
    return head.body; 
}
Copy after login


区别:
  1.php的函数不会在方法签名中指定返回类型
  2.php的函数不会在方法签名中指定参数类型
  3.php的函数可以给参数设定默认值
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template