You need to declare a variable in PHP to store a user's age. How would you do this?
- var userAge = 21;
- int userAge = 21;
- $userAge = 21;
- Declare userAge As Integer = 21
In PHP, variables are declared with a dollar sign ($) followed by the variable name. So, to declare a variable to store a user's age, you would write $userAge = 21; PHP is a loosely typed language, which means that you don't have to declare the data type of a variable when you create it. Learn more: https://www.php.net/manual/en/language.variables.basics.php
Loading...
Related Quiz
- Which of the following are valid data types in PHP?
- What are the differences between cookies and sessions in PHP? When would you choose one over the other?
- Which of the following are common uses of for loops in PHP?
- Which of the following are common uses of the json_encode() and json_decode() functions in PHP?
- What is the operator used for addition in PHP?