Mina
0
Q:

php foreach index

foreach($array as $key=>$value) {
    // do stuff
}
1
$index = 0;
foreach($data as $key=>$val) {
    // Use $key as an index, or...

    // ... manage the index this way..
    echo "Index is $index\n";
    $index++;
}
1
Blog::whereYear('created_at', 2017)->get();
0

New to Communities?

Join the community