Example scenario
Example 1
$var = 'A';
function testar($v)
{
echo 'Início';
if ($v == 'A') {
echo ' : true';
return true;
} else {
echo ' : false';
return false;
}
echo ' : Fim';
}
testar($var);
Output: Início : true
Example 2
$var = 'A';
function testar($v)
{
echo 'Início';
if ($v == 'A') {
echo ' : true';
} else {
echo ' : false';
}
echo ' : Fim';
}
testar($var);
Output: Início : true : Fim
Doubt
- Why does
return
"delete" the rest of script , since it is not contained inif
?