The Arcive of vBulletin Modifications Site. |
|
help with installer script... Details »»
|
|||||||||||||||||||||||||
i need some help to builld a function to automatically replace the " and '.
here it is what i try to do: PHP Code:
what should i use to automatically replace the ' with a \'? a str_replace should do? $ccode[1]=str_replace("'","\'",$ccode[1]); if i do this, i still get parse errors... what is the best aproach to eliminate the \' or \" problem? thank you for reading this. Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
hmm for some reason, the [code] and [php] removed my \ in front of the 'canviewothers'...?
test: \' \" ok... the slash in front of ' is gone... |
|
#3
|
||||
|
||||
|
i was reading about serialize/unserialize on php.net...
i still cant understand the mechanism. can you explain to me how it works? |
|
#4
|
||||
|
||||
|
You can't. Even if you use str_replace on it, you still need to quote it as a string... think about it for a while.
You might want to use the Here Doc syntax, but you will still need to escape variables. |
|
#5
|
||||
|
||||
|
i thought so... then, the only solution is the use that area as html code... thanks alot chen for your precious help.
|
|
#6
|
||||
|
||||
|
I have absolutely no idea what you are trying to achieve with this code but you can always "addslashes" your variable and then "stripslashes" it anytime you want. It seemed to me this is what you were asking, if not, sorry ignore me..
|
|
#7
|
||||
|
||||
|
Ok, take a look at this nakkid.
PHP Code:
|
![]() |
|
|