Anonymous
Переместите ведущие элементы массива в конец, чтобы массив начинался с указанного элемента.
Сообщение
Anonymous » 14 янв 2025, 10:21
Мне интересно, как можно изменить порядок следующего массива:
Код: Выделить всё
Array
(
[1] => Array
(
[0] => stdClass Object
(
[id] => 120
[hteam] => Heatherton
[ateam] => Dingley
[round] => 1
[catid] => Seniors
[date] => Saturday 14th April, 2012
[time] => 12:00am
[venue] => Heatherton Recreational Reserve
)
[1] => stdClass Object
(
[id] => 121
[hteam] => Heatherton
[ateam] => Dingley
[round] => 1
[catid] => Reserves
[date] => Saturday 14th April, 2012
[time] => 11:45am
[venue] => Heatherton Recreational Reserve
)
)
[2] => Array
(
[0] => stdClass Object
(
[id] => 122
[hteam] => Clayton
[ateam] => Heatherton
[round] => 2
[catid] => Seniors
[date] => Saturday 21st April, 2012
[time] => 12:00am
[venue] => Clayton Reserve
)
[1] => stdClass Object
(
[id] => 139
[hteam] => Clayton
[ateam] => Heatherton
[round] => 2
[catid] => Reserves
[date] => Saturday 21st April, 2012
[time] => 12:00am
[venue] => Clayton Reserve
)
)
[3] => Array
(
[0] => stdClass Object
(
[id] => 123
[hteam] => Heatherton
[ateam] => St Pauls
[round] => 3
[catid] => Seniors
[date] => Saturday 28th April, 2012
[time] => 12:00am
[venue] => Heatherton Recreational Reserve
)
[1] => stdClass Object
(
[id] => 140
[hteam] => Heatherton
[ateam] => St Pauls
[round] => 3
[catid] => Reserves
[date] => Saturday 28th April, 2012
[time] => 12:00am
[venue] => Heatherton Recreational Reserve
)
)
[4] => Array
(
[0] => stdClass Object
(
[id] => 124
[hteam] => Mordialloc
[ateam] => Heatherton
[round] => 4
[catid] => Seniors
[date] => Saturday 5th May, 2012
[time] => 02:00pm
[venue] => Ben Kavanagh Reserve
)
[1] => stdClass Object
(
[id] => 141
[hteam] => Mordialloc
[ateam] => Heatherton
[round] => 4
[catid] => Reserves
[date] => Saturday 5th May, 2012
[time] => 11:45am
[venue] => Ben Kavanagh Reserve
)
)
)
От ^^ до этого:
Код: Выделить всё
Array
(
[3] => Array
(
[0] => stdClass Object
(
[id] => 123
[hteam] => Heatherton
[ateam] => St Pauls
[round] => 3
[catid] => Seniors
[date] => Saturday 28th April, 2012
[time] => 12:00am
[venue] => Heatherton Recreational Reserve
)
[1] => stdClass Object
(
[id] => 140
[hteam] => Heatherton
[ateam] => St Pauls
[round] => 3
[catid] => Reserves
[date] => Saturday 28th April, 2012
[time] => 12:00am
[venue] => Heatherton Recreational Reserve
)
)
[4] => Array
(
[0] => stdClass Object
(
[id] => 124
[hteam] => Mordialloc
[ateam] => Heatherton
[round] => 4
[catid] => Seniors
[date] => Saturday 5th May, 2012
[time] => 02:00pm
[venue] => Ben Kavanagh Reserve
)
[1] => stdClass Object
(
[id] => 141
[hteam] => Mordialloc
[ateam] => Heatherton
[round] => 4
[catid] => Reserves
[date] => Saturday 5th May, 2012
[time] => 11:45am
[venue] => Ben Kavanagh Reserve
)
)
[1] => Array
(
[0] => stdClass Object
(
[id] => 120
[hteam] => Heatherton
[ateam] => Dingley
[round] => 1
[catid] => Seniors
[date] => Saturday 14th April, 2012
[time] => 12:00am
[venue] => Heatherton Recreational Reserve
)
[1] => stdClass Object
(
[id] => 121
[hteam] => Heatherton
[ateam] => Dingley
[round] => 1
[catid] => Reserves
[date] => Saturday 14th April, 2012
[time] => 11:45am
[venue] => Heatherton Recreational Reserve
)
)
[2] => Array
(
[0] => stdClass Object
(
[id] => 122
[hteam] => Clayton
[ateam] => Heatherton
[round] => 2
[catid] => Seniors
[date] => Saturday 21st April, 2012
[time] => 12:00am
[venue] => Clayton Reserve
)
[1] => stdClass Object
(
[id] => 139
[hteam] => Clayton
[ateam] => Heatherton
[round] => 2
[catid] => Reserves
[date] => Saturday 21st April, 2012
[time] => 12:00am
[venue] => Clayton Reserve
)
)
)
Итак, в этом примере массив начинается с номера 3, переходит к номеру 4, а затем снова возвращается к номеру 1. Имеет ли это смысл?
Подробнее здесь:
https://stackoverflow.com/questions/104 ... fied-eleme
1736839290
Anonymous
Мне интересно, как можно изменить порядок следующего массива: [code]Array ( [1] => Array ( [0] => stdClass Object ( [id] => 120 [hteam] => Heatherton [ateam] => Dingley [round] => 1 [catid] => Seniors [date] => Saturday 14th April, 2012 [time] => 12:00am [venue] => Heatherton Recreational Reserve ) [1] => stdClass Object ( [id] => 121 [hteam] => Heatherton [ateam] => Dingley [round] => 1 [catid] => Reserves [date] => Saturday 14th April, 2012 [time] => 11:45am [venue] => Heatherton Recreational Reserve ) ) [2] => Array ( [0] => stdClass Object ( [id] => 122 [hteam] => Clayton [ateam] => Heatherton [round] => 2 [catid] => Seniors [date] => Saturday 21st April, 2012 [time] => 12:00am [venue] => Clayton Reserve ) [1] => stdClass Object ( [id] => 139 [hteam] => Clayton [ateam] => Heatherton [round] => 2 [catid] => Reserves [date] => Saturday 21st April, 2012 [time] => 12:00am [venue] => Clayton Reserve ) ) [3] => Array ( [0] => stdClass Object ( [id] => 123 [hteam] => Heatherton [ateam] => St Pauls [round] => 3 [catid] => Seniors [date] => Saturday 28th April, 2012 [time] => 12:00am [venue] => Heatherton Recreational Reserve ) [1] => stdClass Object ( [id] => 140 [hteam] => Heatherton [ateam] => St Pauls [round] => 3 [catid] => Reserves [date] => Saturday 28th April, 2012 [time] => 12:00am [venue] => Heatherton Recreational Reserve ) ) [4] => Array ( [0] => stdClass Object ( [id] => 124 [hteam] => Mordialloc [ateam] => Heatherton [round] => 4 [catid] => Seniors [date] => Saturday 5th May, 2012 [time] => 02:00pm [venue] => Ben Kavanagh Reserve ) [1] => stdClass Object ( [id] => 141 [hteam] => Mordialloc [ateam] => Heatherton [round] => 4 [catid] => Reserves [date] => Saturday 5th May, 2012 [time] => 11:45am [venue] => Ben Kavanagh Reserve ) ) ) [/code] От ^^ до этого: [code]Array ( [3] => Array ( [0] => stdClass Object ( [id] => 123 [hteam] => Heatherton [ateam] => St Pauls [round] => 3 [catid] => Seniors [date] => Saturday 28th April, 2012 [time] => 12:00am [venue] => Heatherton Recreational Reserve ) [1] => stdClass Object ( [id] => 140 [hteam] => Heatherton [ateam] => St Pauls [round] => 3 [catid] => Reserves [date] => Saturday 28th April, 2012 [time] => 12:00am [venue] => Heatherton Recreational Reserve ) ) [4] => Array ( [0] => stdClass Object ( [id] => 124 [hteam] => Mordialloc [ateam] => Heatherton [round] => 4 [catid] => Seniors [date] => Saturday 5th May, 2012 [time] => 02:00pm [venue] => Ben Kavanagh Reserve ) [1] => stdClass Object ( [id] => 141 [hteam] => Mordialloc [ateam] => Heatherton [round] => 4 [catid] => Reserves [date] => Saturday 5th May, 2012 [time] => 11:45am [venue] => Ben Kavanagh Reserve ) ) [1] => Array ( [0] => stdClass Object ( [id] => 120 [hteam] => Heatherton [ateam] => Dingley [round] => 1 [catid] => Seniors [date] => Saturday 14th April, 2012 [time] => 12:00am [venue] => Heatherton Recreational Reserve ) [1] => stdClass Object ( [id] => 121 [hteam] => Heatherton [ateam] => Dingley [round] => 1 [catid] => Reserves [date] => Saturday 14th April, 2012 [time] => 11:45am [venue] => Heatherton Recreational Reserve ) ) [2] => Array ( [0] => stdClass Object ( [id] => 122 [hteam] => Clayton [ateam] => Heatherton [round] => 2 [catid] => Seniors [date] => Saturday 21st April, 2012 [time] => 12:00am [venue] => Clayton Reserve ) [1] => stdClass Object ( [id] => 139 [hteam] => Clayton [ateam] => Heatherton [round] => 2 [catid] => Reserves [date] => Saturday 21st April, 2012 [time] => 12:00am [venue] => Clayton Reserve ) ) ) [/code] Итак, в этом примере массив начинается с номера 3, переходит к номеру 4, а затем снова возвращается к номеру 1. Имеет ли это смысл? Подробнее здесь: [url]https://stackoverflow.com/questions/10493438/move-leading-array-elements-to-the-end-so-that-array-starts-at-a-specified-eleme[/url]