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
Loading...
Related Quiz
- The filter_input_array() function in PHP is used to get the ______ values and optionally filter them.
- What are some common practices in PHP when dealing with multiple data filtering and validation?
- In PHP, which function is used to get the length of a string?
- The filter_var_array() function in PHP allows you to filter ______ inputs at once.
- What is the $_POST superglobal in PHP?