How to Display the Day Name In Indonesian With PHP Programming Language
How to Display the Day Name In Indonesian With PHP Programming Language
What Will I Learn?
- We will learn how to present the name of the day in Bahasa Indonesia
- We will learn how the function of a function in the program displays the name of the day in Indonesian
- We will learn the difference of making the name of the day with "date" and function
Requirements
- Xampp
- Text Editor
- Browser Aplication
Difficulty
- Basic
Tutorial Contents
Day is a period unit that the earth needs to turn without anyone else pivot. One day comprises of day and night. In spite of the fact that the day does exclude the International Standard unit but rather it is as yet acknowledged for the reasons related with SI [1].
Be that as it may, in discussion for a half-day explanation, it is for the most part important to light instead of night. Moreover, to recognize one day entire day, generally determined inside 24 hours.
For the most part in PHP programming we regularly utilize the capacity "date" for this
program we utilize work which implies is the square of composed and reusable code that is utilized to play out a solitary activity and related. Capacities give better seclusion to applications and abnormal amounts of code use.
In disin we utilize the Switch Case work is an announcement or proclamation exceptionally intended to deal with basic leadership including numerous elective alternatives. Switch explanations are utilized less frequently than IF articulations in java. In any case, it is utilized all the more frequently when we need to record stretching or basic leadership with a lot of choices. In this manner the switch is great to learn.
shows the name of the day the name auto that shows up is the name of the day in English.
Hari.php
"< ?php
function hari_ini(){
$hari = date ("D");
switch($hari){
case 'Sun':
$hari_ini = "Minggu";
break;
case 'Mon':
$hari_ini = "Senin";
break;
case 'Tue':
$hari_ini = "Selasa";
break;
case 'Wed':
$hari_ini = "Rabu";
break;
case 'Thu':
$hari_ini = "Kamis";
break;
case 'Fri':
$hari_ini = "Jumat";
break;
case 'Sat':
$hari_ini = "Sabtu";
break;
default:
$hari_ini = "Tidak di ketahui";
break;
}
return "<b >" . $hari_ini . "< /b>";
}
echo "Hari ini adalah ". hari_ini();
? > "
After the sourcode on run makahasilnya will be like the following.
Clarification of the program
- In the event that you see the hari.php above is the phase that we make is making another capacity.
- Here we will make a capacity with this hari(), in this capacity we make
- overwrite the day information in $hari Then the variable $hari is chosen with the switch case
Such as the following :
" function hari_ini(){
$hari = date ("D");
switch($hari){
case 'Sun':
$hari_ini = "Minggu";
break;
case 'Mon':
$hari_ini = "Senin";
break;
case 'Tue':
$hari_ini = "Selasa";
break;
case 'Wed':
$hari_ini = "Rabu";
break;
case 'Thu':
$hari_ini = "Kamis";
break;
case 'Fri':
$hari_ini = "Jumat";
break;
case 'Sat':
$hari_ini = "Sabtu";
break;
default:
$hari_ini = "Tidak di ketahui";
break;
}
return "< b >" . $hari_ini . "< /b>";
}"
And last we live to restore the name of a successful day in get
As follows:
" return "< b>" . $hari_ini . "< /b>";
And finish now we just call the hari_ini () function to show the day's name in Indonesian.
You can also to change the look like Day which specified to be Heading 1
example:
" }
return "< h1>" . $hari_ini . "< /h1>";
}
echo "Hari ini adalah ". hari_ini();
? > "
the example will look like this :
all you usual edit as you please
Posted on Utopian.io - Rewarding Open Source Contributors
Hello, you received a boost courtesy of @steemdunk! Steem Dunk is an automated curation platform that is easy and free for use by everyone. Need an instant boost? Send 0.200 SBD with your full post url as the memo to @steemdunk for an upvote. Join us at https://steemdunk.xyz
Upvote this comment to support the bot and increase your future rewards!
Your contribution cannot be approved because it is not as informative as other contributions. See the Utopian Rules. Contributions need to be informative and descriptive in order to help readers and developers understand them.
You can contact us on Discord.
[utopian-moderator]