object(stdClass)#3911 (4) {
["owner_name"]=>
string(8) "Вано"
["teams"]=>
string(14) "Франция"
["teamplayer_goal"]=>
string(1) "6"
["teamplayer_name"]=>
string(8) "Жиру"
}
[8]=>
object(stdClass)#3912 (4) {
["owner_name"]=>
string(8) "Вано"
["teams"]=>
string(14) "Франция"
["teamplayer_goal"]=>
string(1) "8"
["teamplayer_name"]=>
string(10) "Менез"
}
[9]=>
object(stdClass)#3913 (4) {
["owner_name"]=>
string(8) "Клим"
["teams"]=>
string(12) "Италия"
["teamplayer_goal"]=>
string(1) "1"
["teamplayer_name"]=>
string(16) "Верратти"
}
array(3) {
["Вано"]=>
array(9) {
[0]=>
array(1) {
["Арсенал"]=>
array(2) {
["player_name"]=>
string(25) "Санти Касорла"
["goal_count"]=>
string(1) "1"
}
array(2) {
["player_name"]=>
string(12) "Санчез"
["goal_count"]=>
string(1) "6"
}
array(2) {
["player_name"]=>
string(8) "Жиру"
["goal_count"]=>
string(1) "2"
}
}
[3]=>
array(1) {
["Франция"]=>
array(2) {
["player_name"]=>
string(14) "Матиюди"
["goal_count"]=>
string(1) "1"
}
array(2) {
["player_name"]=>
string(12) "Рибери"
["goal_count"]=>
string(1) "1"
}
}
array(3) {
["Вано"]=>
array(9) {
[0]=>
array(1) {
["Арсенал"]=>
array(2) {
["player_name"]=>
string(25) "Санти Касорла"
["goal_count"]=>
string(1) "1"
}
}
[1]=>
array(1) {
["Арсенал"]=>
array(2) {
["player_name"]=>
string(8) "Жиру"
["goal_count"]=>
string(1) "2"
}
}
[2]=>
array(1) {
["Арсенал"]=>
array(2) {
["player_name"]=>
string(12) "Санчез"
["goal_count"]=>
string(1) "6"
}
}
[3]=>
array(1) {
["Франция"]=>
array(2) {
["player_name"]=>
string(14) "Матиюди"
["goal_count"]=>
string(1) "1"
}
}
[4]=>
array(1) {
["Франция"]=>
array(2) {
["player_name"]=>
string(12) "Рибери"
["goal_count"]=>
string(1) "1"
}
}
$sortedOwners = array();
$sortedTeams = array();
foreach ($teamplayers as $owner_name ) {
$sortedTeam = array();
$sortedTeams[] = array($owner_name->teamplayer_name, $owner_name->teamplayer_goal);
foreach ($sortedTeams as $playergoal) {
$sortedTeam[$owner_name->teams] = array('player_name' => $playergoal[0], 'goal_count' => $playergoal[1]);
}
$sortedOwners[$owner_name->owner_name][] = $sortedTeam;
}
array(6) {
["Арсенал"]=>
array(3) {
[0]=>
array(2) {
["player_name"]=>
string(25) "Санти Касорла"
["goal_count"]=>
string(1) "1"
}
[1]=>
array(2) {
["player_name"]=>
string(8) "Жиру"
["goal_count"]=>
string(1) "2"
}
[2]=>
array(2) {
["player_name"]=>
string(12) "Санчез"
["goal_count"]=>
string(1) "6"
}
}
["Франция"]=>
array(6) {
[0]=>
array(2) {
["player_name"]=>
string(14) "Матиюди"
["goal_count"]=>
string(1) "1"
}
[1]=>
array(2) {
["player_name"]=>
string(12) "Рибери"
["goal_count"]=>
string(1) "1"
}
[2]=>
array(2) {
["player_name"]=>
string(10) "Погба"
["goal_count"]=>
string(1) "2"
}
[3]=>
array(2) {
["player_name"]=>
string(14) "Бензема"
["goal_count"]=>
string(1) "5"
}
[4]=>
array(2) {
["player_name"]=>
string(8) "Жиру"
["goal_count"]=>
string(1) "6"
}
[5]=>
array(2) {
["player_name"]=>
string(10) "Менез"
["goal_count"]=>
string(1) "8"
}
}
$sortedOwners = array();
$sortedTeams = array();
foreach ($teamplayers as $owner_name ) {
$sortedTeam = array();
$sortedTeams[] = array($owner_name->teamplayer_name, $owner_name->teamplayer_goal);
foreach ($sortedTeams as $playergoal) {
$sortedTeam = array('player_name' => $playergoal[0], 'goal_count' => $playergoal[1]);
}
$sortedOwners[$owner_name->teams][] = $sortedTeam;
}
$sortedOwners[$owner_name->owner_name][$owner_name->teams][] = $sortedTeam;