5

Just a simple curiosity. I couldn't find anything on Google, and I definitely don't want to dig into PHP source.

Does array_walk_recursive implement tail call optimization?

1 Answer 1

2

Short answer, no :)

See also: https://github.com/php/php-src/blob/master/ext/standard/array.c#L1097

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any way to use TCO then?
@FlorianMargaine Some languages have optimizations for this, but unfortunately PHP does not; so if you're thinking of using this feature it's probably better to make it iterative instead (which is the poor man's TCO)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.