this seems like a pretty straight forward question and for some reason I am having trouble figuring out how to achieve what I am looking for.
$category = $html2->find('.video_cats',0);
$category = $genre->plaintext;
<div class="video_cats">
<span>Categories:</span>
<a href="http://www.example.com" title="Example Category" class="video_cat">House</a>
<a href="http://www.example.com" title="Example Category" class="video_cat">The Cat</a>
<a href="http://www.example.com" title="Example Category" class="video_cat">Car</a>
<a href="http://www.example.com" title="Example Category" class="video_cat">The Dog</a>
</div>
Currently I have a string called $category
if we print
the results of this string it will return the following text One Two Three Four Five I am trying to make it so that it returns the text One, Two, Three, Four, Five. Any help is greatly appreciated.
EDIT : This is the desired output Category: A Cat, Dog, A Horse, House because some of the category names have spaces in them we can't just replace the spaces with commas.