I have a source array
$A = array(
0=> array(
'title'=>'HTML5+CSS3',
'teacher'=>'jonh',
'id_post'=>1,/* link to $post_formation */
'formation'=>1,
'date'=>'12/12/2112'
)
);
and the an other array:
$post_formation = array(
0=>array(1,2,3),
1=>array(3,4,5)
)
Look in $A to manipulate a new restult (in this case id_post=1 1=>array(3,4,5) so will contain more 3 elements )
$result = array(
/* from $A */
0=> array(
'title'=>'HTML5+CSS3',
'teacher'=>'jonh',
'id_post'=>1,
'formation'=>1,
'date'=>'12/12/2112'
),
/* Append here more 03 elements `3,4,5` */
1=> array(
'title'=>'(A)HTML5+CSS3',
'teacher'=>'jonh',
'id_post'=>1,
'formation'=>3,
'date'=>'--/--/---'
),
2=> array(
'title'=>'(A)HTML5+CSS3',
'teacher'=>'jonh',
'id_post'=>1,
'formation'=>4,
'date'=>'--/--/----'
),
3=> array(
'title'=>'(A)HTML5+CSS3',
'teacher'=>'jonh',
'id_post'=>1,
'formation'=>5,
'date'=>'--/--/----'
)
);
Anyone could tell me how todo this?
Though a little weird……
Result:
The first
print_r:The second
print_r:You can of course wrap the logic in a function instead of plainly modify the source
$A.