How can laravel foreach determine that only the first two lines are looped out.

foreach ($logo as $logo){
    echo "
    <a href="$logo->href"><img src="$logo->img"></a>
  ";
}
?>
Apr.21,2021

laravel collection there are many ready-made functions available, and the query result set is also in the form of a collection. It is recommended to switch to the collection processing. The above can be written as follows: collect ($logo)-> take (2);



$i=0;
foreach ($logo as $logo){
if($i==2){break;}
    echo "
    <a href='$logo->href'><img src='$logo->img'></a>
  ";
    $iPP;
}

the foundation is not firmly shaken. Take a look at the foundation


array_slice (xxx, 0,2) you can also cut
this $logo as $logo is very strong

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b380a9-2c0eb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b380a9-2c0eb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?