Last active
December 16, 2018 20:08
-
-
Save tomatillodesign/85fc9cd492e5f8149cfac0b4d723ac96 to your computer and use it in GitHub Desktop.
A short PHP quiz for CTD, Fall '18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Question 5: /////////////////////////////////////////////////////// | |
// The following code will print "Chris" onto the webpage (True/False): | |
$name = '<h2>Chris</h2>'; | |
// Question 6: /////////////////////////////////////////////////////// | |
// Given the code below, what would you enter inside the foreach loop to display | |
// a separate list item for each instrument in the array? | |
// Please select only the most efficient, shortest possible code as the correct answer. | |
$instruments = array( 'violin', 'piano', 'guitar', 'drums', 'bass' ); | |
foreach( $instruments as $instrument ) { | |
// Your answer here | |
} | |
// A) <li>$instrument</li>; | |
// B) '<li>$instrument</li>'; | |
// C) print_r($instrument); | |
// D) echo '<li>$instrument</li>'; | |
// E) echo '<li>' + $instrument + '</li>'; | |
// F) echo '<li>' . $instrument . '</li>'; | |
// G) echo '<li>' . $instruments . '</li>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment