Advertisements
Advertisements
Question
Explain the Function of Conditional Statements in PHP.
Long Answer
Solution
- Function conditional statement is the function specified inside the conditional statements.
- We can’t call a conditional function before its definition.
Syntax:
if(expression)
{
function function_name( )
{
block of statements;
}
}
function_name( ); // calling function.
Eg:
<? php
display( );
if(TRUE)
{
function display( )
{
echo “condition and function”;
}
}
Output: condition and function
shaalaa.com
Php Conditional Statements
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
What will be the output of the following PHP code?
<?php
$x;
if ($x)
print “hi” ;
else
print “how are u”;
?>
What will be the output of the following PHP code?
<?php
$x = 0;
if ($x++)
print “hi”;
else
print “how are u”;
?>
What will be the output of the following PHP code?
<?php
$x;
if ($x == 0)
print “hi” ;
else
print “how are u”;
print “hello”
?>
What will be the output of the following PHP code?
<?php
$a = “”;
if ($a)
print “all”;
if ______
else
print “some”;
?>
What will be the output of the following PHP code?
<?php
$x = 10;
$y = 20;
if ($x > $y + $y != 3)
print “hi” ;
else
print “how are u”;
?>
Define Conditional Statements in PHP.
List out Conditional Statements in PHP.
Write the features Conditional Statements in PHP.
Differentiate Switch and if else statement.
Explain the working of Conditional Statements in PHP?