Was it
- Code: Select all
if ($x) {
include(myfile.php);
};
To include a file only if x variable was true?
if ($x) {
include(myfile.php);
};
if (condition)
{
include('my_special_file.php');
} if (condition)
{
include("{$phpbb_root_path}my_special_file.$phpEx");
} === expression, that is it must match both value and type.<?php
$a = 0; // var type is int
$d = false; // var type is bool (or boolean)
$c = ''; // var type is string
// an if statement tests a (condition) and if it is true, whatever is inside the { } is performed.
if ($a === false) // since $a is not exactly false, this condition evaluates to false
{
echo '$a is exactly false';
}
else
{
echo '$a is not exactly false';
}
// will echo '$a is not exactly false'
// since the double equal just tests for the value, the following expression will evaluate to true...
if ($a == false)
{
echo '$a is false';
}
// will echo '$a has the value of false'
if ($d === false) // since $d is a bool, and we are testing for bool, the expression evaluates to true
{
echo '$d is exactly false';
}
// will echo '$d is exactly false';
?>

Return to phpBB3 Challenges at phpBB Academy
Users browsing this forum: No registered users and 1 guest