Tampilkan postingan dengan label beginner. Tampilkan semua postingan
Tampilkan postingan dengan label beginner. Tampilkan semua postingan

Rabu, 16 September 2015

PHP Switch Statement Tutorial with Practical Example

What is PHP Switch Statement?

According to php.net The Switch Statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for.

PHP Switch  Statement Syntex

switch (n)
{
case label1:
  code to be executed if n=label1;
  break;
case label2:
  code to be executed if n=label2;
  break;
default:
  code to be executed if n is different from both label1 and label2;
}

PHP Switch  Statement Practical Example

Objective : Creating a program to enter two number and select task from list then display the result.

Coding
<?php
$n1=$_POST['t1'];
$n2=$_POST['t2'];
$ch=$_POST['choice'];
if(isset($_POST['done']))
{
switch($ch)
{
case 'add':
$res=$n1+$n2;
break;
case 'sub':
$res=$n1-$n2;
break;
case 'mul':
$res=$n1*$n2;
break;
case 'div':
$res=$n1/$n2;
break;
}
}
?>
<html><head><title>Form</title></head>
<body>
<form action="" method="post">
Enter First Number<input type="text" name="t1"><br>
Enter Second Number<input type="text" name="t2"><br>
Result<input type="text" value="<?php echo $res;?>"><br>
Select Task:&nbsp;&nbsp;&nbsp;
<input type="radio" name="choice" value="add">ADD
<input type="radio" name="choice" value="sub">SUB
<input type="radio" name="choice" value="mul">MUL
<input type="radio" name="choice" value="div">DIV<br>
<input type="submit" name="done" value="DONE">
</form>
</body>
</html>

Selasa, 03 Februari 2015

Web Developer extension and the choice of Best Web Browser

If you are a web developer then the question is quite common which is

the best web browser for web development . In this tech arena every

browser want to take the number one tag. In this blog I am going to

share my favorite browser and why it became number one .

Mozilla Firefox is my favorite, I accept chrome has taken the market

share for being light and fast, internet explorer 10 is also doing well

but still I die for firefox. Right now I use Firefox 18 , in speed its

par with chrome and IE 10 in some cases faster, but right now we use

modern computer that has atleast 1GB of RAM and dual core CPU so you

can't see the speed difference only benchmarks can tell the difference.

Firefox uses more memory around 130MB but its not a problem.

Firefox offers net and clean interface, always welcome new technologies,

devoted towards open source and also stable and secure. Its extension

arena has everything you need and it makes you special , chrome also

supports extension and has decent store where you can download and

install extension with no restart feature but firefox interface is

awesome as firefox is feature rich compared to chrome. IE is by greedy

microsoft the company is not listening to its old customer as the

support of IE10 is limited to Windows 8 still now does not supports

multiplatform so it was ommitted from my list.



Firefox and the extension we die for :

If we are a web developer or SEO Expert then Firefox makes you job easy,

I am going to share a partial list of my favorite extension.



1. ADBLOCK PLUS

Web Designer has to surf a lot to get new ideas or inspiration but the

the annoying ads and pop ups make the job hard, adblock plus not only

block all these but gives you interface to control it.



2. Colorzilla

If you are a web designer or UI designer then you can't stop yourselve

playing with colors. This is not a color picker tool but has eyedropper

and other cool option.



3. Firebug

HTML , HTML5 , CSS , javascript wonder which kind of scripting is using

this firebug is the only solution, it give not only to view source of

website but with advance option. This is Web Designer no. one app.



4. Webrankstat

This is a SEO tool provides alexa rank, google rank,page index

,backlinks and other information while surfing.



list is going to updated soon.