Skip to content

Instantly share code, notes, and snippets.

View DylanCodeCabin's full-sized avatar

Dylan Auty DylanCodeCabin

View GitHub Profile
<?php
$preferred_color = $colors[1]; //This will set our new variable
//To ‘Green’ from index ‘1’ in the array
?>
<?php
$user_information = array(
“Name” => “John Doe”,
“Gender” => “Male”,
“Age” => “42”
);
?>
<?php
$user_information = array();
$user_information[“Name”] = “John Doe”;
$user_information[“Gender”] = “Male”;
$user_information[“Age”] = “42”;
?>
<?php
$current_user_gender = $user_information[“Gender”];
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<div class=’age_notification’>
<?php
//We would like to output the user’s age here
?>
<div class=’age_notification’>
<?php
echo (“You are “ . $user_age);
?>
</div>
<?php
if($current_weather == “cloudy”){
$welcome_message = “It’s cloudy out, grab a jacket.”;
}
?>
<?php
if($current_weather == “cloudy”){
$welcome_message = “It’s cloudy out, grab a jacket.”;
} else {
$welcome_message = “Looking good out there. Have fun.”;
}
?>
<?php
if($current_weather == “cloudy”){
$welcome_message = “It’s cloudy out, grab a jacket.”;
} else if($current_weather == “raining”){
$welcome_message = “It’s raining out, grab an umbrella.”;
} else {
$welcome_message = “Looking good out there. Have fun.”;
}
?>
<?php
switch ($current_weather) {
case “cloudy”:
$welcome_message = “It’s cloudy out, grab a jacket.”;
break;
case “raining”:
$welcome_message = “It’s raining out, grab an umbrella.”;
break;
default:
$welcome_message = “Looking good out there. Have fun.”;