Module 2: PHP & JS Flashcards
How many times does this loop iterate?
$a = 0;
$b = 1.0;
for ($i = 0; $i < 10; $i++) {
$a += 0.1;
}
echo (($a === $b) ? “yes” : “no”);
10
What is the expected output?
$a = 0;
$b = 1.0;
for ($i = 0; $i < 10; $i++) {
$a += 0.1;
}
echo (($a === $b) ? “yes” : “no”);
No
How many times does this loop iterate?
$a = 0;
$b = 1.0;
for ($i = 0; $i < 10; $i++) {
$a += 0.1;
}
echo ((round($a) === $b) ? “yes” : “no”);
10
What is the expected output?
$a = 0;
$b = 1.0;
for ($i = 0; $i < 10; $i++) {
$a += 0.1;
}
echo ((round($a) === $b) ? “yes” : “no”);
Yes
What is the tag for PHP?
<?php ?>
What is the tag for JavaScript?
“
”
Where does PHP run?
Server-side
Where does JavaScript run?
Client-side
var
Function scope (less strict)
let
Block scope (more restrictive)
const
Block scope (also can’t be changed once set)