+ 6
Why does it say unexpected else placement?
<?php function returnTrue($str){ if ($str == "");{ echo "True"; } else { echo "False"; } return ("") } ?>
4 Answers
+ 15
MyNameIsMutable first error mention by taste about semicolon after if statement which blocking if block so error is coming unnecessary placement of else statement so remove that semicolon
Second error return statement after that semicolon is missing so put that.
Third calling of function with argument is missing add function call.
<?php
function returnTrue($str){
if ($str == ""){
echo "True";
} else {
echo "False";
}
return ("");
}
returnTrue("");
?>
+ 6
you already close if statement with semicolon ( ; )
+ 3
Remove semicolon on 3rd line and move it to after the return("")
0
Helped out allot