fcfvff
Slice-of-Life Aficionado
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
200 XP
In this tutorial we will create a Simple String Conversion using PHP. This code can be use in converting some string easily and automated. PHP is a server-side scripting language designed primarily for web development. Using PHP, you can let your user directly interact with the script and easily to learned its syntax. It is mostly used by a newly coders for its user friendly environment. So Let's do the coding.
Getting started
First you have to download & install XAMPP or any local server that run PHP scripts. In my case I used XAMPP as my local server, here's the link for XAMPP server https://www.apachefriends.org/index.html.
The Main Function
This code contains the main function of the application, This code will automatically convert your string to lowercase or uppercase depend on the word itsetl.To create this just write these block of code in the text editor, then name this file as convert.php
The Main Interface
This is the interface that display the output of the conversion,to make this just write these codes inside your text file, Then save it as index.php
There you have it we successfully created a Simple String Conversion using PHP. I hope that this simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!!
Download
Getting started
First you have to download & install XAMPP or any local server that run PHP scripts. In my case I used XAMPP as my local server, here's the link for XAMPP server https://www.apachefriends.org/index.html.
The Main Function
This code contains the main function of the application, This code will automatically convert your string to lowercase or uppercase depend on the word itsetl.To create this just write these block of code in the text editor, then name this file as convert.php
- <?php
- if
(
ISSET
(
$_GET
[
'word'
]
)
&&
!
empty
(
$_GET
[
'word'
]
)
)
{
- if
(
ctype_lower
(
$_GET
[
'word'
]
)
)
{
- $word
=
$_GET
[
'word'
]
;
- $upper_word
=
strtoupper
(
$word
)
;
- echo
"<h2 class='text-danger'>"
.
$upper_word
.
"</h2>"
;
- }
else
if
(
ctype_upper
(
$_GET
[
'word'
]
)
)
{
- $word
=
$_GET
[
'word'
]
;
- $lower_word
=
strtolower
(
$word
)
;
- echo
"<h2 class='text-danger'>"
.
$lower_word
.
"</h2>"
;
- }
- }
- ?>
The Main Interface
This is the interface that display the output of the conversion,to make this just write these codes inside your text file, Then save it as index.php
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1"/>
- <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
- </head>
- <body>
- <nav class="navbar navbar-default">
- <div class=container-fluid>
- <a class="navbar-brand" href="https://sourcecodster.com">Sourcecodester</a>
- </div>
- </nav>
- <div class="col-md-3"></div>
- <div class="col-md-6 well">
- <h3 class="text-primary">PHP - Simple String Conversion</h3>
- <hr style="border-top:1px dotted #000;"/>
- <form method="GET" action="">
- <div class="col-md-3"></div>
- <div class="form-inline col-md-8">
- <h3>Type a Word</h3>
- <label class="text-success">*Word must be all UPPER or lower to make this work</label>
- <br /><br />
- <input type="text" name="word" class="form-control"/>
- <button type="submit" class="btn btn-primary">Convert</button>
- <br /><br />
- <?php
include
'convert.php'
?>
- </div>
- </form>
- </div>
- </body>
- </html>
There you have it we successfully created a Simple String Conversion using PHP. I hope that this simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!!
Download
You must upgrade your account or reply in the thread to view the hidden content.