first commit

This commit is contained in:
2024-04-30 16:46:24 +02:00
commit 5986046452
2 changed files with 23 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/practice

22
exam52/WordCensoring.php Executable file
View File

@@ -0,0 +1,22 @@
<?php
//Word censoring
$find = array('alex','billy','dale');
$replace = array('a**x', 'b***y', 'd**e');
if(isset($_POST["user_input"]) && !empty($_POST["user_input"])){
$user_input = $_POST['user_input'];
$user_input_new = str_ireplace($find, $replace, $user_input);
echo $user_input_new;
}
?>
<form action="part2.php" method="POST">
<textarea name="user_input" cols="30" rows="6"><?php echo $user_input ;?></textarea><br><br>
<input type="submit" value="Submit">
</form>