Preg_replace: Woord vervangen

Gestart doorRemcoboy5 reacties42 weergaven

6 berichten · pagina 1 van 1

Remcoboy

Lid · Topicstarter

Berichten
4.749
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?
                    $str[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]te Apeldoorn[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$keys[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]te[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$values[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]in[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$specs[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$keys[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$values[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$specs[/COLOR][COLOR= #007700];[/COLOR]
?>


Warning: preg_replace(): Delimiter must not be alphanumeric or backslash on line 4.

Ik krijg het niet voor elkaar om deze werkende te krijgen. Het ligt niet aan de spatie. Op Google kan ik het ook niet vinden..

Alvast bedankt voor je tip!
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Str_replace
0
Remcoboy

Lid · Topicstarter

Berichten
4.749
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Str_replace
Hartstikke bedankt!!
Het antwoord is vaak simpel, maar je komt er nooit op wink
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
met preg replace moet je dit doen:

[COLOR= #0000BB]<?
                    $str[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]te Apeldoorn[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$keys[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/te/[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$values[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]in[/COLOR][COLOR= #007700];[/COLOR]
                    [COLOR= #0000BB]$specs[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$keys[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$values[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$specs[/COLOR][COLOR= #007700];[/COLOR]
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Str_replace is sneller.
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat klopt. Alles met reguliere expressies is per definitie sloom in PHP sadley
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren