我有一个具有这种格式的数组:
array(
info(
Date-today => '09/04/2013'
)
clients(
id => 1001,
name => Fred
)
more_info(
weather-today => "cloudy"
)
)
但有时,我会收到更多客户的数据:
array(
info(
Date-today => '08/04/2013'
)
clients(
0(
id => 1001,
name => Fred
),
1(
id => 1045,
name => Fritz
)
)
more_info(
weather-today => "Sunny"
)
)
我想计算我返回了多少个cients,因为如果只有一个或多个,我需要以不同的方式访问客户端数据。我尝试了几个“count()”选项,例如:
count(array['client'])
但是当然,如果只有 1 个客户端,它不会返回 1,而是返回 2(因为数组中有 2 项客户端数据)。
有小费吗?