Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Test</title>
- </head>
- <body>
- <ul>
- <li>1. Open PHP Tag and Create a Variable</li>
- <li>2. Create a Constant</li>
- <li>3. Define 'x' variable and assign a value to it</li>
- <li>4. Define 'y' variable and assign a value to it. </li>
- <li>5. Do numeric operations (+, -, *, /, %) in 'x' and 'y'</li>
- <li>6. Check if 'x' is greater than or equal to 'y'</li>
- <li>7. Create a array and display it's values</li>
- <li>8. Assign 'I live in Kathmandu, Capital of Nepal.' and count it's characters</li>
- <li>9. Display 'Not equal' if 'x' is not equal to 'y'</li>
- <li>10. Create a variable 'color' and check display it's name using switch statement</li>
- </ul>
- <?php
- //1.
- $name = "alisa";
- echo $name;
- echo '<br/><br/>';
- //2.
- define('VECHILE_NAME', 'toyota');
- echo VECHILE_NAME;
- echo '<br/><br/>';
- //3.
- $x = 4;
- $y = 4;
- echo $x . '<br />';
- $x = $x + $y;
- echo $x . '<br /><br />';
- echo $x + $y . '<br/>';
- echo $x - $y . '<br/>';
- echo $x * $y . '<br/>';
- echo $x / $y . '<br/>';
- echo $x % $y . '<br/>';
- //6.
- if($x >= $y) {
- echo "x is greater then y";
- } else {
- echo "x is smaller then y";
- }
- echo '<br/><br/>';
- //7.
- $name = array('alisa','suman','ram');
- foreach($name as $nam)
- {
- echo $nam . '<br/><br/>';
- }
- echo '<br/>';
- //8.
- $string = 'I live in Kathmandu, Capital of Nepal';
- echo strlen($string);
- echo '<br/><br/>';
- //9.
- if($x != $y){
- echo "Not equal";
- }
- echo '<br/><br/>';
- //10.
- $color = 'blue';
- switch($color){
- case 'red':
- echo "red";
- break;
- case 'blue':
- echo "blue";
- break;
- default:
- echo "no color found";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment