我有一个数组,看起来像这样: 我需要以这种格式的数组供以后在脚本中使用。从一系列值中选择一个特定的值数组php
//this is only 1 values set there are others that are returned.
Array
(
[DealerName] => Auto Bavaria Midrand MINI
[CustomersCounted] => 16
[Satisfied_Y] => 10
[Satisfied_N] => 6
[InterviewDate] => 2012-01-13
)
我打电话给我循环的数组$customerSatisfactionRatings
。
foreach($customerSatisfactionRatings as $customerSatisfactionRating) {
$content .= $customerSatisfactionRating';
}
这会将正确的值返回到内容变量中。 我感兴趣的是从[Satisfied_Y]
键创建一个字符串。
什么,我需要一个例子是$content = '10,5,15,7,8,9,0,3';
我知道如何使字符串,而不是如何只提取[Satisfied_Y]
关键。 这让我难过。
我尝试这个方法和我的一切是每个阵列元件中的第一个字母:A,1 1,6,2初始阵列是二维阵列。这可能会导致它? – user1882752 2013-02-22 08:05:00
@ user1882752 ya。这可能是问题所在。 – 2013-02-22 08:06:51
我已经改变了我获取数据的方式,所以它是一个标准数组,这是行得通的,我会在我能够接受的时候接受答案。 – user1882752 2013-02-22 08:08:53