Q:
PHP find output programs (conditional statements) | set 1
belongs to collection: PHP Find Output Programs
PHP Find Output Programs
- PHP find output programs (basics) | set 1
- PHP find output programs (basics) | set 2
- PHP find output programs (basics) | set 3
- PHP find output programs (Superglobals) | set 1
- PHP find output programs (conditional statements) | set 1
- PHP find output programs (conditional statements) | set 2
- PHP find output programs (conditional statements) | set 3
- PHP find output programs (switch Statement) | set 1
- PHP find output programs (switch Statement) | set 2
- PHP find output programs (switch Statement) | set 3
- PHP find output programs (Operators) | set 1
- PHP find output programs (Operators) | set 2
- PHP find output programs (Operators) | set 3
- PHP find output programs (Loops) | set 1
- PHP find output programs (Loops) | set 2
- PHP find output programs (Loops) | set 3
- PHP find output programs (Loops) | set 4
- PHP find output programs (Arrays) | set 1
- PHP find output programs (Arrays) | set 2
- PHP find output programs (Arrays) | set 3
- PHP find output programs (User-defined functions) | set 1
- PHP find output programs (User-defined functions) | set 2
- PHP find output programs (User-defined functions) | set 3
- PHP find output programs (String Functions) | set 1
- PHP find output programs (String Functions) | set 2
- PHP find output programs (Number Functions) | set 1
- PHP find output programs (Math Functions) | set 1
- PHP find output programs (Math Functions) | set 2
- PHP find output programs (Date and Time) | set 1
- PHP find output programs (define Constant) | set 1
- PHP find output programs (static variables, classes, methods) | set 1
- PHP find output programs (static variables, classes, methods) | set 2
- PHP find output programs (Regular Expressions) | set 1
- PHP find output programs (Exceptions) | set 1
- PHP find output programs (Exceptions) | set 2
- PHP find output programs (Filters) | set 1
- PHP find output programs (Filters) | set 2
- PHP find output programs (JSON) | set 1
- PHP find output programs (const Keyword) | set 1
- PHP find output programs (Class & Objects) | set 1
- PHP find output programs (Class & Objects) | set 2
- PHP find output programs (Class & Objects) | set 3
- PHP find output programs (Constructors and Destructors) | set 1
- PHP find output programs (Constructors and Destructors) | set 2
- PHP find output programs (Constructors and Destructors) | set 3
- PHP find output programs (Inheritance) | set 1
- PHP find output programs (Inheritance) | set 2
- PHP find output programs (Inheritance) | set 3
Answer 1:-
Output:
Explanation:
In the above program, we used if...else statements, Here, we defined a variable $PI with value 3.14, and checked equality condition with the value returned by PI() function. But PI() function returns value 3.1415926535898, which is different from 3.14 then the condition gets false.
Answer 2:
Output:
Explanation:
In the above program, we created two variables $A and $B initialized with 20 and 12 respectively.
$A = $A*12+5; $B = 20*($B/2*2)+5;
Now evaluate the above expressions:
$A = $A*12+5; $A = 20*12+5; $A = 240+5; $A = 245;
And,
$B = 20*($B/2*2)+5; $B = 20*(12/2*2)+5; $B = 20*(6*2)+5; $B = 20*12+5; $B = 240+5; $B = 245;
Then the value of $A and $B will be the same, so the condition gets true and "www.includehelp.com" will be printed on the console screen.
Answer3:-
Output:
Explanation:
In the above program, we created two variables $NUM1 and $NUM2.
$NUM1 = intval(PI()); $NUM2 = (81/pow(3,3));
Let's evaluate the above expression:
$NUM1 = intval(PI()); $NUM1 = intval(3.1415926535898); $NUM1 = 3;
And then,
$NUM2 = (81/pow(3,3)); $NUM2 = (81/27)); $NUM2 = 3;
Now condition if ($NUM1===$NUM2) will be true, and then "www.includehelp.com" will print on the webpage.
Answer4:-
Output:
Explanation:
In the above program, we used nested print() function. The print() function returns 1 on successful printing, otherwise, it returns false.
Let's evaluate the below statement:
if (print(print("Hello World ")))
The inner print() will print "Hello World " and return 1, then the outer print() function will print 1 and return 1 then the condition will true and print "www.includehelp.com" on the webpage.
Answer5:-
Output:
Explanation:
In the above program, we defined two variables $A and $B initialized with 10 and 20 respectively. Here, we used the printf() function, which is used for print formatted output. The printf() returns the total number of characters printed on the webpage.
$R = printf("Hello : %d,%d ",$A, $B);
In the above statement will print "Hello : 10,20 " on the webpage and return 14, which is assigned to variable $R. Then the if condition gets false, and "www.google.com" will be printed on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer