From 107223d3a0f65c89ac0c2afa4ead3fa6a8545004 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sun, 8 Apr 2018 22:32:42 +0100 Subject: [PATCH] Avoid recomputation --- Parsedown.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Parsedown.php b/Parsedown.php index 8fac5cd..238ec0e 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -572,13 +572,15 @@ class Parsedown $matches[1] .= ' '; } + $markerWithoutWhitespace = strstr($matches[1], ' ', true); + $Block = array( 'indent' => $Line['indent'], 'pattern' => $pattern, 'data' => array( 'type' => $name, 'marker' => $matches[1], - 'markerType' => ($name === 'ul' ? strstr($matches[1], ' ', true) : substr(strstr($matches[1], ' ', true), -1)), + 'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : substr($markerWithoutWhitespace, -1)), ), 'element' => array( 'name' => $name,