1

So I can do array(Type::NUMBER=>1), and I can do array(Type::STRING=>"one")

But how do I do array(Type::BOOLEAN=>true)

True, I can just use numbers, and input either a 0 or a 1, but I figured I'd check to see if there was a way I can do this.

1 Answer 1

3

From the PHP Docs:

The key can either be an integer or a string. The value can be of any type.

(Emphasis mine)

PHP: Arrays - Manual

For example:

$array = array(
           "key1" => true,
           "key2" => false,
           "key3" => false,
           "key4" => true
         );
Sign up to request clarification or add additional context in comments.

2 Comments

So it has to be either one of those two? Thanks
The key can be either an integer or string, but the value can be anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.