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
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *