PHP - Basic Programing
To create
and execute a basic PHP programming
1. Start Xampp server (Apache)
2. Goto virtual path folder (C:\xampp\htdocs)
3. Create test.php file and type the program
4. Execute the program on your Web browser using by this URL link (http://localhost/ test.php)
<html>
<body>
<?php
echo “Welcome to Our School”;
$color = “blue”;
echo “My car is “ . $color .
«<br>”;
echo “My dress is “ . $COLOR .
«<br>”;
echo “My box is “ . $coLOR .
«<br>”;
//test whether a number is greater
than 30, 20 or 10 using ternary operator
functiontrinary_Test($n)
{
$r = $n > 30
“greater than 30”
: ($n > 20
“greater than 20”
($n >10
?“greater than 10”
:“Input a number atleast greater than
10!”));
echo $n.” : “.$r.”\n”;
}
trinary_Test(32);
trinary_Test(21);
trinary_Test(12);
trinary_Test(4);
?>
</body>
</html>
Welcome to Our School
My car is blue
My dress is
My box is
32 : greater than 30
21 : greater than 20
12 : greater than 10
4 : Input a number atleast greater than 10!
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.