The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Stripping line breaks from a string - ereg_replace & str_replace
I have a problem with a script in that the script saved line breaks between values that were saved. Well, the script was written that way for another purpose but now it is causing me issues...
I know I can take normal text like this and remove the /n's $myvalues = 'cars/ntrucks/nautomibiles'; Using code like this: $myvalues = ereg_replace('/n', '', $myvalues); HOWEVER, I do not know how to remove LINE BREAKS which I assume would be \n in the data? For example: PHP Code:
Quote:
EDIT to change the title to help someone else that may search this! |
#2
|
||||
|
||||
It's \n and not /n... (backslash). And it should go between double quotes.
|
#3
|
|||
|
|||
Quote:
I have also been trying to do the same thing with "str_replace" so I used that in my test code too. Here is my test code: PHP Code:
Quote:
|
#4
|
||||
|
||||
Remove the "carriage return" characters as well.
PHP Code:
|
#5
|
|||
|
|||
Quote:
Thank You, that was the problem! My Test Code: PHP Code:
Quote:
|
#6
|
||||
|
||||
You're welcome. I'm happy to help.
|
#7
|
||||
|
||||
You should use the Perl functions (preg) for regex rather than the PHP ones (ereg).
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|