Jump to content

Question about count


JSHINER

Recommended Posts

Put an if inside your loop, then keep adding to a variable and set it into an array:

$i = 0;
$array = array();
foreach ($page['people'] as $z)
{
    $date = date('m-d-y', strtotime($z['date']));

    $now = date('m-d-y');

    if($date == $now)
    {
        $array[] = "Whatever you want to store here";
    }
}

for($i=0; $i <= 7; $i++)
{
    echo $array[$i];
}

 

Link to comment
https://forums.phpfreaks.com/topic/92120-question-about-count/#findComment-471789
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.