Oke ik weet het toch niet;
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// $return = str_replace(" ", "", $data);[/COLOR]
[COLOR= #0000BB]$words[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]scheld[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// de woorden[/COLOR]
[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);[/COLOR] [COLOR= #FF8000]// als er een . in staat vervangen door niks[/COLOR]
[COLOR= #0000BB]$main[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$words[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// als dat woord zonder punt erin staat vervangen door %scheld%[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$main[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Scheld woord[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geen[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Als ik nu "scheld" invoer krijg ik Geen, als ik "s.cheld" invoer krijg ik ook Geen?
en als ik $main echo krijg ik Array.
Wat doe ik nu fout?
toevoeging op 8 december 2012, 13:29:13:Ow, laat maar het moest natuurlijk met in_array()
toevoeging op 8 december 2012, 13:43:43:Oke, nu snap ik het niet:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// $return = str_replace(" ", "", $data);[/COLOR]
[COLOR= #0000BB]$words[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]scheld[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// de woorden[/COLOR]
[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$words[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$words[/COLOR][COLOR= #007700])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]JA[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]%scheld%[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]jah[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]r[/COLOR][COLOR= #007700]];
}[/COLOR][URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]nee<br>Words:[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$words[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]<br>Check:[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Als ik nu hallo in typ staat er jah? terwijl hallo niet in de array staat?