I am trying to get a string of words located between the words "Free" and "LESSON", which works just fine when I have a string that consists of one text block with one instance of "Free" and "LESSON" only. The challenge I am facing is how to achieve this when there are a multiple, line break separated text blocks in one string?
<?php
$value = '
Sam Mutimer
3m 8s
Social Media credit
Free
How to find your social media audience
LESSON
How to find your social media audience
Sam Mutimer
3m 20s
Social Media credit
Free
Defining your social media personality
LESSON
Defining your social media personality
Sam Mutimer
2m 5s
Social Media credit
Free
Dealing with complaints on social media
LESSON
Dealing with complaints on social media';
$value = strstr($value, "Free", true); //gets all text from needle on
$value = strstr($value, "LESSON", true); //gets all text before needle
echo $value;
?>
My best guess is to put the string into an array, but how does one separate the existing string into multiple substrings based on a line break?
Appreciate any help, thank you.