Welcome to another part of the PHP Quiz series, again some interesting questions to crack your brain about. If you have some nice additions or questions, be sure to leave a comment. Enjoy part three!
As always, think of the answer before you execute the code or look it up. You can find round two here.
Unset cast
What is the type of $a and what is the type of $b
Form fun
What will the output be?
<form method=
"post" action=
"" enctype=
"text/plain">
<input name=
"search" type=
"text">
<input type=
"submit">
</form>
<?php
error_reporting( E_ALL );
echo (string
) filter_input
(INPUT_POST,
'search');
?>
Fun with strings
Strings in PHP are versatile, but how versatile are they... What will the output be?
$juggling =
"Itffkhmf";
$rox =
"Spy";
$b =
$c =
"";
for ($i=
0;
$i<strlen
($juggling);
$i++
) { $b .=
$juggling[ $i ];
$b++;
} for ($i=
0;
$i<strlen
($rox);
$i++
) { $c .=
$rox[ $i ];
$c--;
}var_dump( $b,
$c );
Continue reading "PHP Quiz part 3"