this text block represents the original external source that is a variable:
// the following characters are not-consistent
text here
// the following characters are consistent
♥ text1
♥ text2
♥ text3
// the following characters are consistent
some more text here
i want to remove everything except for "text here" and i have to do this in ‘parts’ as other text may be present (ie i can’t just remove everything after "text here").
i can remove "some more text here" but am having trouble trying to target and remove the lines beginning with ♥ (or ♥ as they are currently being stored in the database).
so these are my variables
// this is the original external source
$part_one = $external_source;
// this is the variable that is not working yet
$part_one_a = ;
// this replaces "some more text here" with nothing
$part_one_b = str_replace("some more text here", " ", $part_one);
// this concatenates the variables $part_one_a and $part_one_b
$final = $part_one_a . $part_one_b;
thank you.
update
to be more specific i need a way to remove text such as this:
♥ link_one: http://link_one_here.com/
♥ link_two: http://link_two_here.com/
♥ link_three: http://link_three_here.com/
update two
i’ve managed to remove all unwanted items with str_replace on an array.
the only thing i cannot target and therefore remove is the ♥.
i have tried targeting it with:
♥(this is the value that is currently being stored in the
database)♥(after i applied a htmlentities to the string)
and no luck – the ♥ is still being displayed. if anyone can tell me how i can target ♥ it would be much appreciated and this question would be resolved.
thank you.
the solution was:
this resulted in all the desired values being shown without instances of non-acceptable characters.
the code for the last two steps is below: