I'm looking for a way in PHP (with regex, maybe?) to convert a string of HTML that includes links into a string of plain text that adds the URL of the link after the text.
Here's an example of what I'm thinking:
$html = '<p><a href="http://www.example.com/maybe/something/here/">Link name</a>
for something or another. <a href="https://www.examplesecure.com/">Another link
</a> to something else.</p>'
// Regex to find the URLs
????
// Add the found URLs as strings after the closing a tags
????
// Convert to plain text
$text = trim(strip_tags($html));
Ideally, I'd end up with this string:
Link name [http://www.example.com/maybe/something/here/] for something or another.
Another link [https://www.examplesecure.com/] to something else.