我需要用逗号分隔值分解stdentid数组。目前,studentid数组位于多维数组中,我需要所有值都必须以逗号分隔
结果应该是针对Studentid数组
[studentid] => 36399,96500,96503,96509,96512等。
Array
(
[started] => 1
[studentid] => Array
(
[1] => Array
(
[0] => 36399
)
[2] => Array
(
[0] => 96500
[1] => 96503
[2] => 96506
[3] => 96509
[4] => 96512
[5] => 96515
)
[3] => Array
(
[0] => 96501
[1] => 96504
[2] => 96507
[3] => 96510
[4] => 96513
)
[4] => Array
(
[0] => 96502
[1] => 96505
[2] => 96508
[3] => 96511
[4] => 96514
)
)
[name] => Test
[name_or_email] =>
[submitbtn] => 1
)
答案 0 :(得分:-1)
假设变量是$ studentsResult(包含您发布的整个数组)
在这种情况下:
implementation 'androidx.core:core:1.1.0'
implementation 'androidx.media:media:1.1.0'
然后是foreach($studentsResult['studentid'] as $studentId => $studentValues){
$tempStudents[$studentId] = join(',',$studentValues);
}
,您可能正在寻找\
但是,如果所有这些ID必须在那个学生的下面,那么您没有说出ID在哪里,但是您可以按照以下答案回答平坦化数组中的问题,或者执行以下操作:
$tempStudents