Home  >  Article  >  Backend Development  >  第一篇博文:PHP函数原型中的可选参数写法为什么这么写?,_PHP教程

第一篇博文:PHP函数原型中的可选参数写法为什么这么写?,_PHP教程

WBOY
WBOYOriginal
2016-07-13 09:45:25776browse

第一篇博文:PHP函数原型中的可选参数写法为什么这么写?,

第一篇,算是开始吧。简单写点儿东西。

刚开始学PHP,在看PHP Manual时遇到一个问题:含可选参数的函数原型中,可选参数的写法看不懂。

例如explode函数

<span>array explode ( string $delimiter , string $string [, int $limit ] )
</span>

可选参数都用“[方括号]”括起来,那么第三个参数$limit为可选参数。

可是为什么不这么写呢:

<span>array explode ( string $delimiter , string $string ,[int $limit ] )
</span>

实在是无法理解这个逗号的位置。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1042018.htmlTechArticle第一篇博文:PHP函数原型中的可选参数写法为什么这么写?, 第一篇,算是开始吧。简单写点儿东西。 刚开始学PHP,在看PHP Manual时遇到一...
Statement:
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