我这里有一个动态的数组。 targetCourse数组包含stepNumber,stepTitle,description& courseId。 courseId再次是动态的,包含id,coursePrice& courseImage字段。
<label for="Card">Credit Card (16 Digit Number)</label>
<br/>
<input type="radio" id="Visa" name="Type1">
<label>Visa</label>
<br/>
<input type="radio" id="Master" name="Type1">
<label>MasterCard</label>
<input id="Card" name="Card" type="text" hidden="true" />
<label id="CardError"></label>
如何遍历它以存储此类数据
WHERE (x BETWEEN from_1 AND to_1) OR (x BETWEEN from_2 AND to_2)
答案 0 :(得分:0)
如果基本数组结构和键保持不变,那么确切地说你正在寻找什么,但是要解决这个问题。我将基本数组作为$result
array(
'targetCourse' => array(
'stepNumber' => $result[0]['stepNumber'],
'stepTitle' => $result[0]['stepTitle'],
'description' => $result[0]['description'],
'courseId' => array(
'courseImageUrl' => $result[0]['courseId'][0]['courseImageUrl'],
'courseTitle' => $result[0]['courseId'][0]['courseTitle'],
'coursePrice' => $result[0]['courseId'][0]['coursePrice'],
'id' => $result[0]['courseId'][0]['id']
)
)
);
将输出
Array
(
[targetCourse] => Array
(
[stepNumber] =>
[stepTitle] =>
[description] =>
[courseId] => Array
(
[courseImageUrl] => /images/613975354956722176/HENkLeDExX_t.jpg
[courseTitle] => Java
[coursePrice] => 0
[id] => 616716226880155648
)
)
)