From a9d62327050f13ec0da165c55bf092fcbf64107c Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Sun, 17 Nov 2013 13:21:49 +0200 Subject: [PATCH] =?UTF-8?q?array=5Fshift=20=C2=BB=20unset=20to=20simplify?= =?UTF-8?q?=20code=20base=20and=20improve=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Parsedown.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 22f33ba..b44e87c 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -432,7 +432,7 @@ class Parsedown } } - # li + # li if ($deindented_line[0] <= '9' and $deindented_line >= '0' and preg_match('/^([ ]*)\d+[.][ ](.*)/', $line, $matches)) { @@ -483,7 +483,7 @@ class Parsedown $elements []= $element; - array_shift($elements); + unset($elements[0]); # # ~ @@ -491,7 +491,7 @@ class Parsedown $markup = ''; - foreach ($elements as $index => $element) + foreach ($elements as $element) { switch ($element['type']) { @@ -501,7 +501,7 @@ class Parsedown $text = preg_replace('/[ ]{2}\n/', '
'."\n", $text); - if ($context === 'li' and $index === 0) + if ($context === 'li' and $markup === '') { if (isset($element['interrupted'])) {