MyBB Community Forums

Full Version: Turn text between tags into a variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I get the text between tags into a variable?

For example:

This is just [tag]a[/tag] test text!

I want to get: $variable = a;
to use it in a function? do this:
//Open functions_post.php
//Find:
	$message = preg_replace("#\[email=(.*?)\](.*?)\[/email\]#i", "<a href=\"mailto:$1\">$2</a>", $message);
//After it, add:
	$message = preg_replace("#\[your_tag\](.*?)\[/your_tag\]#ei", "your_function(\"$1\")", $message);
$1 will be the text between the tags.
Thanks a lot! Big Grin