Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $words = Collection::make(['apple', 'pear', 'melon', 'cherry']);
- foreach ($words as $word) {
- echo $word . "<br>";
- }
- $words->each(function ($word) {
- echo $word . "<br>";
- if ($word == 'melon') {
- return false; //dinnyéig elég kiírni
- }
- });
- $students = Collection::make([['Géza', 15, '4/E'], ['Ferenc', 16, '5/A'], ['Gergő', 17, '6/C']]);
- $students->eachSpread(function ($name, $age, $class) {
- echo "$name $age éves és a(z) $class osztályba jár.<br>";
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement