[PHP] str_replace question

2002-09-01 Thread Gregor Jak¹a

Hello, i have array $reserved_words which i want to replace with bold ..
but when i tried to do str_replace($reserved_words,
b.$reserved_words./b, $string) it showed Array instead of
bword/b
if i simply do  str_replace($reserved_words, $reserved_words, $string) then
it shows the words not Array but not in bold ;)
I know i could use 2 arrays one with bold words one without or i could use
foreach but i want a simpler solution :)... Any suggestions ?


thx in advance !



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] help with preg_replace()

2002-07-01 Thread Gregor Jak¹a

ive been tryin to find a solution for this problem for some hours now, but i
just dont know how to do it... so i ask for ur assistance. Lemme list some
examples, so u can see what im tryin to do :)
word = word
word = | word |
word = | word |
word = |word |
word = | word|

So if pattern is word it should stay word, if patter is word it should
replace it with |word | and so on as u see from examples... any help or
hints would be helpfull...

thats what i have now: preg_replace(#^[|]?[^\](.*?)[^\]$#i, | \\0 |,
$string); .. but it doesnt work :P

thx in advance !



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php