1. Which of the following PHP statement can appear in an if-statement if $variable is a string of characters, e.g., $var

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

1. Which of the following PHP statement can appear in an if-statement if $variable is a string of characters, e.g., $var

Post by answerhappygod »

1. Which of the following PHP statement can appear in an
if-statement if $variable is a string of characters, e.g.,
$variable contains “Test” prior to the if-statement?
if($variable = "test") echo "OK";
if($variable == "test") echo "OK";
2. What will the following statements generate?
$variable1 = 10;
$variable2 = “10”;
if ($variable1 == $variable2)
echo “Same”;
else
echo “Different”;
An error message will be display
Different
Same
None of the above
3. What message will be displayed by following statement?
$str = "Hello world. It's a beautiful day.";
print_r (explode(" ",$str));
Hello world. It's a beautiful day.
Helloworld.It'sabeautifulday.
An error message.
Array ( [0] => Hello [1] => world. [2] => It's [3]
=> a [4] => beautiful [5] => day. )
4. What will be displayed by following statement?
printf("%.2f", 2.345);
2.345
2.34
2.35
None of the above
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply