What will be printed?$var = true;if ($var) { echo 'true';} else { echo 'false';}Question 3Select one:a.falseb.errorc.warningd.true
Question
What will be printed?var) { echo 'true';} else { echo 'false';}Question 3Select one:a.falseb.errorc.warningd.true
Solution
The code provided is written in PHP.
Step 1: Declare a variable named var is true using an if statement. Step 3: Since the condition is true, the code inside the if block will be executed. Step 4: Inside the if block, the string 'true' will be printed using the echo statement.
Therefore, the output will be: true.
Similar Questions
What will this code display?<?php $a = 1; function Test() { echo "a = $a"; } Test();?>Question 10Select one:a.1b.3c.Warning or no valued.An error
In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:Question 29Select one:a.Falseb.True
What will be the output of the following code?boolean flag = true;if (flag == false) { System.out.println("False");} else { System.out.println("True");}FalseTrueCompilation errorNo output
What will be printed?$var=’a’;$VAR=’b’;echo “$var$VAR”;Question 15Select one:a.aAb.aac.bBd.ab
What will be the output of the following PHP code?<?php$x = 10;$y = 20;if ($x > $y && 1||1) print "PHP MCQ TEST!" ;else print "Welcome to Marwadi University!";?>Group of answer choicesWelcome to Marwadi University!errorPHP MCQ TEST!no output
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.