How to get current recursion level in a PHP function ? I mean, is there any \"magical\" (or eventually normal) function like this :
function doSomething($thi
function doSomething($things) { static $level = 0; if (is_array($things)) { foreach ($things as $thing) { $level++; doSomething($thing); } } else { // This is what I want : echo $level } }