<div class="owl-carousel educationItems">
<?php
$array = explode(PHP_EOL, $q->mentor_education);
foreach($array as $line) {
$line = strip_tags($line);
list($year, $text) = explode('-', $line);
echo '
<div class="educationItem">
<div class="educationYear">' . $year . '</div>
<div class="educationText">' . $text . '</div>
</div>
';
}
?>
</div>
preg_match_all('~(?<=<p>).+?(?=</p>)~', $str, $match);
$data = array_map(function($n) {
return explode('-', $n, 2);
}, $match[0]);