MCPcopy Create free account
hub / github.com/deuill/go-php / value_array_index_get

Function value_array_index_get

engine/value.c:311–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311engine_value *value_array_index_get(engine_value *arr, unsigned long idx) {
312 HashTable *h = NULL;
313 engine_value *val = value_new();
314
315 switch (arr->kind) {
316 case KIND_ARRAY:
317 case KIND_MAP:
318 h = Z_ARRVAL_P(arr->internal);
319 break;
320 case KIND_OBJECT:
321 h = Z_OBJPROP_P(arr->internal);
322 break;
323 default:
324 // Attempting to return the first index of a non-array value will return
325 // the value itself, allowing for implicit conversions of scalar values
326 // to arrays.
327 if (idx == 0) {
328 value_set_zval(val, arr->internal);
329 return val;
330 }
331
332 return val;
333 }
334
335 VALUE_ARRAY_INDEX_GET(h, idx, val);
336}
337
338engine_value *value_array_key_get(engine_value *arr, char *key) {
339 HashTable *h = NULL;

Callers

nothing calls this directly

Calls 2

value_newFunction · 0.85
value_set_zvalFunction · 0.85

Tested by

no test coverage detected