You need to store a user's age in your PHP script. What data type would you use and why?

  • int
  • float
  • string
  • boolean
To store a user's age in a PHP script, you would use the int data type. The int data type is used for storing whole numbers, such as the age of a person. Since the age is typically represented as a whole number without a decimal, int is the most appropriate data type for this scenario. Using int ensures that the value is stored efficiently and allows for mathematical operations if needed. Learn more: https://www.php.net/manual/en/language.types.integer.php
Add your answer
Loading...

Leave a comment

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