Wednesday, March 21, 2012

Word Censoring app in php using str_ireplace(); function


<?php

$find = array('waqas', 'ali', 'wahab');
$replace = array('w***', 'a**', '****');


if(isset($_POST['user_input']) or !empty($_POST['user_name'])) {
 $user_input = $_POST['user_input'];
 $user_input_2 = str_ireplace($find, $replace, $user_input);
 echo $user_input_2;
 }


?>
<hr>
<form action="app2.php" method="post">
<textarea name="user_input" cols="30" rows="6"></textarea></br></br>
<input type="submit" value="submit">
</form>

No comments:

Post a Comment