henrywright
henrywright

Reputation: 10240

PHP: Square brackets in a function's description

I fully understand everything about the following function description aside from the square brackets. What do they mean? And what is the reason for the comma after the opening square-bracket?

Taken from the PHP manual:

Description

string substr ( string $string , int $start [, int $length ] )

I've read through the FAQs but found nothing. Apologies if the question seems basic, it's always been something that has eluded me.

Upvotes: 1

Views: 717

Answers (1)

Ashutosh Nigam
Ashutosh Nigam

Reputation: 876

Square bracket means the parameter is optional. Means you may choose to ignore length then function will take default value for it that is 1.

Upvotes: 3

Related Questions