Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was trying to find help from the PHP manual (http://de2.php.net/manual/en/function.array-multisort.php) but the description syntax for parameters is too complex, like

  bool array_multisort ( array &$array1 [, mixed $array1_sort_order = SORT_ASC [, mixed   $array1_sort_flags = SORT_REGULAR [, mixed $... ]]] )

I know that the parameters are there described, like:

array1

An array being sorted.

array1_sort_order

The order used to sort the previous array argument. Either SORT_ASC to sort ascendingly or SORT_DESC to sort descendingly.

but what's the meaning of that description and square brackets?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
187 views
Welcome To Ask or Share your Answers For Others

1 Answer

The parameters between brackets are optional parameters

I will explain a little to clarify:

bool array_multisort ( array &$array1 [, mixed $array1_sort_order = SORT_ASC [, mixed   $array1_sort_flags = SORT_REGULAR [, mixed $... ]]] )

Params:

  • array &$array1: This is the first paramter and is obligatory (not in square brackets), and is the array you want to sort.

  • mixed $array1_sort_order = SORT_ASC: The second parameter, this is sort order and is an optional parameter, if you don't specify then the default value is SORT_ASC

And so on...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...