Complete the code to assign a string to the variable.
<?php
$var = [1];
echo gettype($var);The variable is assigned a string value, so gettype() returns "string".
Complete the code to add an integer and a float, showing PHP dynamic typing.
<?php $result = 5 + [1]; echo gettype($result);
Adding an integer and a float results in a float type in PHP.
Fix the error in the code to correctly concatenate a string and an integer.
<?php $text = "Age: "; $age = 30; echo $text [1] $age;
+ which performs arithmetic addition instead of concatenation.In PHP, the dot operator . is used to concatenate strings.
Fill both blanks to create an array with keys as strings and values as integers.
<?php $data = ["one" => [1], "two" => [2]]; print_r($data);
The keys are strings, and the values should be integers without quotes.
Fill all three blanks to create a variable, assign a boolean, and print its type.
<?php $[1] = [2]; echo gettype($[3]);
The variable named flag is assigned the boolean true, and gettype() prints "boolean".
