there is an array
array(7){ [0]=> array(7) { ["id"]=> string(2) "13" ["id_user"]=> string(1) "2" ["id_serial"]=> string(1) "6" ["date"]=> string(10) "2016-06-26" ["active"]=> string(1) "1" ["total_count"]=> string(1) "4" } [1]=> array(7) { ["id"]=> string(2) "17" ["id_user"]=> string(1) "2" ["id_serial"]=> string(1) "5" ["date"]=> string(10) "2016-06-26" ["active"]=> string(1) "1" ["total_count"]=> string(1) "2" } } it comes in the $ tday variable to the $ top variable onboarding doesn't have a code
$count=0; foreach($top as $post){ тут код foreach ($tday[$count] as $today) { var_dump($today)."<br/>"; } и дальше код $count=$count+1; } What is the point I need to get an array that corresponds to the iteration number of the foreach ($ top as $ post) cycle and continue to work with it, but I get it
string(2) "13" string(1) "2" string(1) "6" string(10) "2016-06-26" string(1) "1" string(1) "4" string(2) "13" string(1) "2" string(1) "6" string(10) "2016-06-26" string(1) "1" string(1) "4" I would still like to get at the first iteration
[0]=> array(7) { ["id"]=> string(2) "13" ["id_user"]=> string(1) "2" ["id_serial"]=> string(1) "6" ["date"]=> string(10) "2016-06-26" ["active"]=> string(1) "1" ["total_count"]=> string(1) "4" } and at the second
[0]=> array(7) { ["id"]=> string(2) "17" ["id_user"]=> string(1) "2" ["id_serial"]=> string(1) "5" ["date"]=> string(10) "2016-06-26" ["active"]=> string(1) "1" ["total_count"]=> string(1) "2" } so that I could work with them for example to make a condition
$count=0; foreach($top as $post){ foreach ($tday[$count] as $today) { echo $today['id']."<br/>"; $count=$count+1;} } and to get
13 17 considering that there will be ten arrays
echo '<pre>'; print_r($today); echo '</pre>';echo '<pre>'; print_r($today); echo '</pre>';..... instead of a print you can wardamp - Alexey Shimansky