Which of the following are true about arrays in PHP?
- Arrays can only store values of the same data type.
- Arrays can have both numeric and string keys.
- Arrays cannot be nested within each other.
- Arrays cannot be modified once they are created.
In PHP, arrays can have both numeric and string keys. This allows for flexibility in accessing and organizing data within the array. Arrays can store values of different data types, including strings, integers, floats, booleans, and even other arrays. Additionally, arrays can be modified by adding, updating, or removing elements. Nesting arrays within each other is also possible, leading to multidimensional arrays. Learn more: https://www.php.net/manual/en/language.types.array.php
Loading...
Related Quiz
- What PHP function is used to return the highest value from a list of numbers?
- You are writing a PHP script and you need to encode an array into a JSON object. How would you do this?
- What can be the potential issues with using break and continue in PHP?
- In PHP, are objects passed by value or by reference?
- What can be potential issues when sorting arrays in PHP?