I have a form that I have to pull some strings out of. The form uses long dashed lines for dividing data sets. It would be handy to use:
strpos($string, "----")
and
$file2= explode("-----", $file1)
but they don’t seem to work. I have replaced the “-” with “.” and used “…..” in the above to successfully extract the needed data, but it removes wanted dashes, such as 2-year-old, in the extracted data. So I’m back to wanting to use “—-” in the code lines above.
I also tried to just replace “–” to “..” but the following doesn’t work either.
$string = str_ireplace("--", "..",$string );
Any suggestions would be appreciated.
Thanks.
Is there a way to make this work?
This works perfectly fine.
Displays “2-year-old” w/o any issues. If you must convert the dashes to something else, try this as well:
…and then explode using periods.