Senin, 08 April 2013

Basic make program with algorithms

 Algorithms are the heart of the core computer, The basic algorithm make a program.
example of a basic program :
/*-----------------------------1. SYNTAX----------------------------------*/ <p>

<html>
<body>
<?php
echo"Hello World";
?>
</body>
</html>


<p>

/*-----------------------------1.1 COMMENT--------------------------------*/ <p>
<html>
<body>
<?php
//This is a comment
/* This is a Comment
Block*/
echo"Saya sedang Belajar PHP </br>";
echo"Apakah Anda Sedang Belajar PHP ?";
?>
</body>
</html>

<p>
/*-----------------------------2. VARIABLE---------------------------------*/ <p>
<?
$txt="Hello World";
$x=16;
echo $txt."<br>";
echo $x;
?>




<p>
/*-----------------------------3. STRING---------------------------------*/ <p>
<?php
$txt="Hello World";
echo $txt;
?>





<p>
/*-----------------------------3.1 STRING concatenation---------------------------------*/ <p>
<?php
$txt1= "Hello World!";
$txt2= "What a Nice Day!";
echo $txt1. " " .$txt2;
?>



<p>
/*-----------------------------3.2 STRING STRLEN---------------------------------*/ <p>
<?php
echo strlen ("Hello WOrld!");
?>




<p>
/*-----------------------------3.3 STRING STRPOS--------------------------------*/ <p>
<?php
echo strpos ("Hello World!", "world");
?>




<p>
/*-----------------------------4.1 OPERATOR arihtmatic --------------------------------*/ <p>
<?php
echo" 3+4 = ", 3+4, "<br>";
echo" 3-4 = ", 3-4, "<br>";
echo" 3*4 = ", 3*4, "<br>";
echo" 3/4 = ", 3/4, "<br>";

?>



<p>
/*-----------------------------4.2 OPERATOR assignment --------------------------------*/ <p>
<?
$a=16;
$b=20;
$c=$a + $b;

echo" \$a = $a <br>";
echo" \$b = $b <br>";

echo " \$a + \$b = $c";
?>


<p>
/*-----------------------------4.3 OPERATOR comparison --------------------------------*/ <p>
<?
$a=10;
$b=20;
$c="aku";
$d="kamu";

echo" $a < $b =  " ,$a<$b, "<br>";
echo" $a == $b =  " ,$a==$b, "<br>";
echo" $a != $b =  " ,$a!=$b, "<br>";
?>




<p>
/*-----------------------------4.4 OPERATOR logical --------------------------------*/ <p>



<p>
/*-----------------------------5. IF --------------------------------*/ <p>

0 comments :

Posting Komentar

Please write criticism and suggestions...

TV ONLINE