Jump to content

Get A String Between 2 Markers..?


cyfer65
 Share

Recommended Posts

Is there any universal PHP function to get the string between 2 specified markers in a string..??<<<$RandomText>>>like say I wanted to always get the $RandomText that was between "<<<" and ">>>" is there any PHP function to do this..??like StringBetween($Var, $Start, $End)

Link to comment
Share on other sites

You could use regular expressions:

preg_match_all("/<<<(.*?)>>>/", $string, $matches);print_r($matches);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...