Solution Review: Make Variables
Let's see the detailed solution review of the variable challenge given in the previous lesson
We'll cover the following
Let’s have a look at the solution before jumping onto the solution:
$intNumber = 1000;$charName = 'N';$boolAccept = 1;$floatNum = 10.292;print $intNumber . ", ";print $charName . ", ";print $boolAccept . ", ";print $floatNum;
Explanation
We have declared:
-
an integer type variable
$intNumber
and assigned it a value of 1000 -
a character type variable
$charName
and assigned it a value of ‘N’ -
a boolean type variable
$boolAccept
and assigned it a value of 1 -
a floating type variable
$floatNum
and assigned it value of 10.292
After declaring the variables, we used the print
statement to display them and we have used .
operator to concatenate the ,
with the result.