From 5a6d7248fcbc3f88fe66f3b52d51087698c3e6ba Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Tue, 17 Apr 2018 15:46:41 +0200 Subject: title intro lien --- fn/fn.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'fn') diff --git a/fn/fn.php b/fn/fn.php index 79007ef..b075d57 100644 --- a/fn/fn.php +++ b/fn/fn.php @@ -34,5 +34,23 @@ function head($title) } +function search($haystack, $debut, $fin) +{ + $list = []; + + $indexdebut = strpos($haystack, $debut); + if ($indexdebut !== false) { + $indexdebut += strlen($debut); + $indexfin = strpos($haystack, $fin, $indexdebut); + if ($indexfin !== false) { + array_push($list, substr($haystack, $indexdebut, $indexfin - $indexdebut)); + $haystack = substr($haystack, $indexfin); + $list = array_merge($list, search($haystack, $debut, $fin)); + } + } + return $list; + +} + ?> -- cgit v1.2.3