Array Key Coercion
Cast passed value into a PHP "array key" type. An "array key" in PHP it can be one of two types, either a string or an int number.
Input Value | Output Result | Description |
|---|---|---|
|
| Returns string value "as is" |
|
| Returns int value "as is" |
|
| |
|
| |
|
| |
|
| Converts float to an int without losing precision [1] |
|
| Converts |
|
| Returns the value of the backed enum's case |
|
| Returns the name of the unit enum's case |
Other |
| Throws |
Notes
The float value must satisfy the following rules:
Must not be more than
PHP_INT_MAXMust not be less than
PHP_INT_MINThe mantissa should be
0(should be no loss of precision)
For objects implementing the
Stringableinterface, the__toString()method will be called.