diff --git a/Parsedown.php b/Parsedown.php index eebd2f9..9b7a3e9 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -1664,26 +1664,22 @@ class Parsedown protected function elementsApplyRecursive($closure, array $Elements) { - $newElements = array(); - - foreach ($Elements as $Element) + foreach ($Elements as &$Element) { - $newElements[] = $this->elementApplyRecursive($closure, $Element); + $Element = $this->elementApplyRecursive($closure, $Element); } - return $newElements; + return $Elements; } protected function elementsApplyRecursiveDepthFirst($closure, array $Elements) { - $newElements = array(); - - foreach ($Elements as $Element) + foreach ($Elements as &$Element) { - $newElements[] = $this->elementApplyRecursiveDepthFirst($closure, $Element); + $Element = $this->elementApplyRecursiveDepthFirst($closure, $Element); } - return $newElements; + return $Elements; } protected function element(array $Element)