| 215 | } |
| 216 | |
| 217 | unsigned int value_array_size(engine_value *arr) { |
| 218 | switch (arr->kind) { |
| 219 | case KIND_ARRAY: |
| 220 | case KIND_MAP: |
| 221 | return Z_ARRVAL_P(arr->internal)->nNumOfElements; |
| 222 | case KIND_OBJECT: |
| 223 | // Object size is determined by the number of properties, regardless of |
| 224 | // visibility. |
| 225 | return Z_OBJPROP_P(arr->internal)->nNumOfElements; |
| 226 | case KIND_NULL: |
| 227 | // Null values are considered empty. |
| 228 | return 0; |
| 229 | } |
| 230 | |
| 231 | // Non-array or object values are considered to be single-value arrays. |
| 232 | return 1; |
| 233 | } |
| 234 | |
| 235 | engine_value *value_array_keys(engine_value *arr) { |
| 236 | HashTable *h = NULL; |