Which of the following are true about indexed arrays in PHP?
- Indexed arrays use string keys to access elements.
- Indexed arrays preserve the order of elements.
- Indexed arrays can have elements of different data types.
- Indexed arrays can only store a single value.
The correct option is 2. Indexed arrays in PHP use numeric keys to access elements, not string keys. Indexed arrays preserve the order of elements, allowing for sequential access. Indexed arrays can indeed store elements of different data types, including strings, integers, floats, booleans, and even other arrays. Indexed arrays can store multiple values and are a versatile data structure in PHP. Learn more: https://www.php.net/manual/en/language.types.array.php#language.types.array.syntax
Loading...
Related Quiz
- You need to destroy a session in your PHP script. How would you do this?
- You are writing a PHP script and you need to store multiple values in a single variable for easy manipulation. How would you do this using an array?
- What are some common practices in PHP when using abstract classes in OOP?
- Which PHP data type can hold multiple values?
- In PHP, you can connect to a MySQL database using the mysqli_connect function.