A simple program to ask the user to give a string or sentence and then the program will convert the vowel characters in a given string or sentence by the user using PHP programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Capitalize Vowels in PHP</title>
<style>
*,html {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #fefefe;
font-family: sans-serif;
background-color: #19BC9D;
}
.container {
background: #fff;
border: none;
text-align: center;
min-width: 300px;
color: #fff;
}
.title {
background-color: #14A083;
padding: 20px;
border: none;
}
.output_wrapper {
padding: 20px;
font-size: 20px;
background-color: #fff;
margin: 10px 0;
border: none;
color: #14A083;
}
h1 {
margin: 0 0 5px;
line-height: 1;
}
p {
margin: 15px 0 0;
}
input {
display: block;
width: 100%;
margin-bottom: 20px;
padding: 10px;
font-size: 15px;
text-align: center;
}
.output {
margin: 10px 0;
}
button,
.btnRetry {
background-color: #14A083;
color: #fff;
border: none;
border-radius: 2px;
text-align: center;
text-transform: uppercase;
text-decoration: none;
cursor: pointer;
font-size: 15px;
padding: 15px 10px;
width: 100%;
display: block;
margin: 20px 0 0;
}
</style>
</head>
<body>
<div class="container">
<div class="title">
<h1>Capitalize Vowels in PHP</h1>
<p>Created By:</p>
<h2>» Jake R. Pomperada, MAED-IT, MIT «</h2>
</div>
<div class="output_wrapper">
<?php
if(isset($_POST["txtString"])){
$string = strtolower($_POST["txtString"]);
$vowels = array('a', 'e', 'i', 'o', 'u');
$output = str_replace($vowels, array_map('strtoupper', $vowels), $string);
echo '<p>The output is:</p>
<h3 class="output">'.$output.'</h3>
<a href="php_capitalize_vowels.php" class="btnRetry">Retry?</a>';
} else {
echo '<form action="" method="post">
<label>Enter a string here:</label>
<input type="text" name="txtString" required>
<button type="submit">Submit</button>
</form>';
}
?>
</div>
</div>
</body>
</html>
No comments:
Post a Comment