Skip to content

Conversation

@phanan
Copy link
Collaborator

@phanan phanan commented Oct 18, 2018

Adding a repeat() function that can be used to create a function that can be used to execute a given closure multiple times.

InvalidArgumentException::assertPositiveInteger($times, __FUNCTION__, 1);

for ($i = 0; $i < $times; $i++) {
call_user_func($callback);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$callback() would work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't $callback() PHP7 only?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can assign a function to a variable since PHP5.3 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lstrojny Done.

@phanan
Copy link
Collaborator Author

phanan commented Sep 25, 2019

Replaced by #193.

@phanan phanan closed this Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants