-1

I have a string like so:

$variable = "here is<br/>my code";

I want to trash anything after the <br/>. How can I go about this?

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0
<?php
echo strtok('here is<br/>my code','<') . '<br/>';

Output:

here is<br/>

With the caveat that the split here is on the < character not necessarily a <br/>.

Progrock
  • 7,373
  • 1
  • 19
  • 25