0% found this document useful (0 votes)
14 views2 pages

PHP Sample Code

The document contains PHP code that prints Hello World, compares two variables, and uses a while loop to count down from 10.

Uploaded by

Rean kazushikita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

PHP Sample Code

The document contains PHP code that prints Hello World, compares two variables, and uses a while loop to count down from 10.

Uploaded by

Rean kazushikita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>App Dev</title>
</head>
<body>
<?php
echo "<h1>Hello World</h1><br>";
echo "Hello World<br>";
$a = 10;
$b = 20;
$x = $a > $b ? "$a is larger" : "$b is larger";
echo $x;
?>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>App Dev</title>
</head>
<body>
<?php
echo "<h1>Hello World</h1><br>";
echo "Hello World<br>";
$a = 10;
$b = 20;
//$x = $a > $b ? "$a is larger" : "$b is larger";
if ($a > $b) {
$x = "$a is larger";
} else {
$x = "$b is larger";
}
echo $x;
?>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>App Dev</title>
</head>
<body>
<?php
$num = 10;
while ($num > 0) {
echo $num . "<br>";
$num--;
}

?>
</body>
</html>

You might also like