1 <?php
2
3 namespace Docolight\Support;
4
5 /**
6 * HTML helper.
7 *
8 * @author Krisan Alfa Timur <krisanalfa@docotel.co.id>
9 */
10 class Html
11 {
12 /**
13 * Get text between tags.
14 *
15 * @param string $string The string with tags
16 * @param string $tagname the name of the tag
17 *
18 * @return string Text between tags
19 */
20 public static function text($string, $tagname)
21 {
22 preg_match("#<\s*?$tagname\b[^>]*>(.*?)</$tagname\b[^>]*>#s", $string, $matches);
23
24 return trim(def($matches, 1, null));
25 }
26 }
27