Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

Array syntax in method arguments

Вы здесь:

Some methods require an array argument. This means that square brackets with an optional index are added to the end of the argument name in a GET or POST request. The index is an integer greater than zero, indicating the position of the element in the array. For example, the request:[0]=email&field_names[1]=Name

means the transfer of the field_names argument to the importContacts method as an array of two elements: email, Name.

If the index is omitted, the position of the element in the array is determined by the position of the argument in the request. For example:[]=email&field_names[]=Name

results in the transfer of the same array as in the previous example.

Arrays can be multidimensional, and in this case the first pair of brackets in the argument name is followed by the second pair of brackets. In addition, the indices may not follow in the right order, and then some elements of the array will be empty. Example illustrating both of these features:[0][0]=xxx&data[0][2]=yyy

In this case, data is a two-dimensional array in the zero string, in which only zero and second cell is filled, and the first one is empty.

Оцените, на сколько вам показалась полезной статья «Array syntax in method arguments»