0

I'm working on a php script for work, I've got most of it figured out and spent hours, trying to get this working. Here's the deal. I've got this information.

</i>xxxx at \<a href=\"http://xxx/xxx/xxxx/11205xxx3887\" data-hovercard=\"/ajax/xxxx/xxx.php?id=112054175xxx3887\">xxxxx\</a>\</span>\

Ofcourse i'm trying to format this to be readable, something like,

xxxx at xxxxx

problem is the url changes constantly or i could just use a easy substr or something.

Any suggestions???

3
  • Use strip_tags. Commented Sep 24, 2011 at 20:04
  • why not use actual values instead of confusing 'xxxxx' or 'xxx' text? Commented Sep 25, 2011 at 4:01
  • Providing several example of actual strings would provide people with more to work with in assisting you with an answer. Dont forget to select the best answer if one has already been provided and give upticks to those that are close but not the best. Commented Sep 25, 2011 at 11:32

2 Answers 2

2

Use the the following:

$str = strip_tags($str);

See php.net/strip_tags

Sign up to request clarification or add additional context in comments.

Comments

0

Here is my best attempt. It would be helpful if you could provide a larger section of code to work with, and if you could explain what the xxxx stands for it would make it much easier to solve your problem. Are they characters, numbers, times, prices? And do you know the origin of all the kooky forward slashes? Very unsettling...

I used the code as it was provided, so you may want to watch out for the last trailing \. When I copied your code into my text editor it pasted as \n rather than \.

$string = "</i>xxxx at \<a href=\"http://xxx/xxx/xxxx/11205xxx3887\" data-hovercard=\"/ajax/xxxx/xxx.php?id=112054175xxx3887\">xxxxx\</a>\</span>\\";

$modified_string = trim(stripslashes(strip_tags($string)), '\\');

echo $modified_string;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.