> iterator_to_array(new InfiniteIterator(new ArrayIterator([1])));
Conversation
Notices
-
Embed this notice
Annika Backstrom (annika@xoxo.zone)'s status on Monday, 12-Feb-2024 22:46:50 JST Annika Backstrom -
Embed this notice
Annika Backstrom (annika@xoxo.zone)'s status on Monday, 12-Feb-2024 22:47:43 JST Annika Backstrom seriously though, i just want to pass an additional argument to my array_map() callback
-
Embed this notice
Annika Backstrom (annika@xoxo.zone)'s status on Monday, 12-Feb-2024 22:49:39 JST Annika Backstrom @chrastecky my way is more fun!
-
Embed this notice
Dominik (chrastecky@phpc.social)'s status on Monday, 12-Feb-2024 22:49:40 JST Dominik @annika That's a long way to write
> while(true) {}
-
Embed this notice
Annika Backstrom (annika@xoxo.zone)'s status on Tuesday, 13-Feb-2024 03:30:28 JST Annika Backstrom @stormsweeper yeah i would assume that's pretty efficient given copy-on-write. `array_fill(0, count($arr), $my_argument)`
-
Embed this notice
Anthony (stormsweeper@dice.camp)'s status on Tuesday, 13-Feb-2024 03:30:29 JST Anthony @annika you can pass multiple arrays if you can make one of the same length
-
Embed this notice
Anthony (stormsweeper@dice.camp)'s status on Tuesday, 13-Feb-2024 04:31:25 JST Anthony @annika oh if it's just the same var for all invocations you can use `use`: `function($foo) use ($someVar) {}` https://www.php.net/manual/en/functions.anonymous.php#example-541
(this `use` not to be confused with the other uses of `use` 🙃) -
Embed this notice
Annika Backstrom (annika@xoxo.zone)'s status on Tuesday, 13-Feb-2024 04:31:53 JST Annika Backstrom @stormsweeper In the end I used an arrow function, it's just a shame to break the terseness of the first-class callable syntax `foo(...)`
-
Embed this notice
Annika Backstrom (annika@xoxo.zone)'s status on Tuesday, 13-Feb-2024 05:13:42 JST Annika Backstrom @stormsweeper It's truuuue, honestly I use Itertools most of the time for a pleasing one-liner 😅
-
Embed this notice
Anthony (stormsweeper@dice.camp)'s status on Tuesday, 13-Feb-2024 05:13:44 JST Anthony @annika I also feel morally obligated to recommend the use for foreach for complex cases 😎
-
Embed this notice