Skip to content

Instantly share code, notes, and snippets.

@JeffreyWay
Last active August 16, 2024 08:02
Show Gist options
  • Save JeffreyWay/25076f684a3e1cba9869772095b166fd to your computer and use it in GitHub Desktop.
Save JeffreyWay/25076f684a3e1cba9869772095b166fd to your computer and use it in GitHub Desktop.
PHP For Beginners, Episode 5 - Conditionals and Booleans
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h1>
<?= 'Hello World' ?>
</h1>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
<style>
body {
display: grid;
place-items: center;
height: 100vh;
margin: 0;
font-family: sans-serif;
}
</style>
</head>
<body>
<?php
$name = "Dark Matter";
$read = true;
if ($read) {
$message = "You have read $name";
} else {
$message = "You have NOT read $name";
}
?>
<h1>
<?= $message ?>
</h1>
</body>
</html>
@Sajjalh7
Copy link

<title>Hello World</title>
$name = "Jungle Book";
$read =true;
if($read){
$message = "You have read $name";
}
else{
$message = "You have not read $name";
}
?>

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment