What will be the following script output?

<?php
$a = 1;
$a = $a— + 1;
echo $a;
?>

A. 2
B. 1
C. 3
D. 0
E. Null

Answer B is correct.

php question

I want to combine two variables together: $var1 = 'Welcome to '; $var2 = 'TechInterviews.com'; What will work faster? Code sample 1: $var 3 = $var1.$var2; Or code sample 2: $var3 = "$var1$var2";

code sample 1 works faster.

code sample 1 works faster. Because concatenation of strings works faster than substitution..

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.