我有2个数组,其中包含数据I&m; m合并为第3个数据。数组显示正确,但是当我尝试对其运行count()时,它返回0,这没有任何意义。
foreach ($xmlm->support_team as $support_team){
$arr_team['Teams'][(string)$support_team->name]['Representatives'] = array(0);
$members = $support_team->members;
foreach ($members->representative as $representative){
$teamMemberID = $representative->attributes();
$teamMemberName = $representative->display_name;
foreach ($xmlr->rep as $rep){
$repID = $rep->attributes();
If (strcmp($repID, $teamMemberID) == 0){
$repcountperteam = $repcountperteam + 1;
$arr_team['Teams'][(string)$support_team->name]['Representatives'][0] = $repcountperteam;
$repName = $rep->public_display_name;
$sessionCount = $rep->support_session_count + $rep->presentation_count;
$repDirectLink = $rep->direct_link->a['href'];
$arr_team['Teams'][(string)$support_team->name]['Representatives'][] =
"Direct Chat With <a href="
. $repDirectLink . "&customer_name="
. $samname . "&c2cjs=1 target=\"_blank\">"
. $repName . "</a> (currently in "
. $sessionCount . " sessions)<br />";
}
}
}
$repcountperteam = 0;
}
如果我尝试做
print_r(count($arr_team->teams));
或
echo count($arr_team->teams);
它返回0?
当我显示数组时,它看起来像这样......
Array
(
[Teams] => Array
(
[Clinical Apps] => Array
(
[Representatives] => Array
(
[0] => 1
[1] => Direct Chat With servicea (currently in 0 sessions)
)
)
[Pass-Thru] => Array
(
[Representatives] => Array
(
[0] => 0
)
)
[Support] => Array
(
[Representatives] => Array
(
[0] => 14
[1] => Direct Chat With Snair, Adam (currently in 1 sessions)
[2] => Direct Chat With Ponce, Agustin (currently in 0 sessions)
[3] => Direct Chat With Fink, Kevin (currently in 1 sessions)
[4] => Direct Chat With D'Sousa, Roshni (currently in 1 sessions)
[5] => Direct Chat With Kazmierczak, Jon (currently in 0 sessions)
[6] => Direct Chat With Sanchez, Nick (currently in 1 sessions)
[7] => Direct Chat With Quinto, Joseph (currently in 0 sessions)
[8] => Direct Chat With Peralta, Oswaldo (currently in 1 sessions)
[9] => Direct Chat With Deonarain, Jason (currently in 1 sessions)
[10] => Direct Chat With Lysikatos, Chris (currently in 1 sessions)
[11] => Direct Chat With Ford, Andre (currently in 0 sessions)
[12] => Direct Chat With Lau, Mark (currently in 0 sessions)
[13] => Direct Chat With Ferrigno, Chris (currently in 0 sessions)
[14] => Direct Chat With Mendez, Oscar (currently in 0 sessions)
)
)
)
)
1