GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
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/08/ |
Upload File : |
<?php date_default_timezone_set('America/Chicago'); ?> <!DOCTYPE html> <html lang="en"> <head> <title>ternary operator</title> <meta charset="utf-8"> </head> <body> <h1>ternary operator</h1> <?php $intA = 5; $intB = $intA+1; echo "\$intA = ",var_dump($intA); echo("<br>\n"); echo "\$intB = ",var_dump($intB); echo("<br>\n"); $strOne = $intA > $intB ? 'greater than' : ($intA < $intB ? 'less than' : 'equal to'); echo '1 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA > $intB ? 'greater than' : $intA < $intB ? 'less than' : 'equal to'; echo '2 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA < $intB ? 'less than' : ( $intA > $intB ? 'greater than' : 'equal to' ); echo '3 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA < $intB ? 'less than' : $intA > $intB ? 'greater than' : 'equal to'; echo '4 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; ?> <br> <?php $intB = $intA-1; echo "\$intA = ",var_dump($intA); echo("<br>\n"); echo "\$intB = ",var_dump($intB); echo("<br>\n"); $strOne = $intA > $intB ? 'greater than' : ($intA < $intB ? 'less than' : 'equal to'); echo '1 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA > $intB ? 'greater than' : $intA < $intB ? 'less than' : 'equal to'; echo '2 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA < $intB ? 'less than' : ( $intA > $intB ? 'greater than' : 'equal to' ); echo '3 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA < $intB ? 'less than' : $intA > $intB ? 'greater than' : 'equal to'; echo '4 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; ?> <br> <?php $intB = $intA; echo "\$intA = ",var_dump($intA); echo("<br>\n"); echo "\$intB = ",var_dump($intB); echo("<br>\n"); $strOne = $intA > $intB ? 'greater than' : ($intA < $intB ? 'less than' : 'equal to'); echo '1 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA > $intB ? 'greater than' : $intA < $intB ? 'less than' : 'equal to'; echo '2 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA < $intB ? 'less than' : ( $intA > $intB ? 'greater than' : 'equal to' ); echo '3 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; $strOne = $intA < $intB ? 'less than' : $intA > $intB ? 'greater than' : 'equal to'; echo '4 The first variable is ',$strOne,' the second variable.',"\n"; echo "<br>\n"; ?> <br> </body> </html>