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

Method Slice

engine/value.go:223–237  ·  view source on GitHub ↗

Slice returns the internal PHP value as a slice of interface types. Non-array values are implicitly converted to single-element slices.

()

Source from the content-addressed store, hash-verified

221// Slice returns the internal PHP value as a slice of interface types. Non-array
222// values are implicitly converted to single-element slices.
223func (v *Value) Slice() []interface{} {
224 size := (int)(C.value_array_size(v.value))
225 val := make([]interface{}, size)
226
227 C.value_array_reset(v.value)
228
229 for i := 0; i < size; i++ {
230 t := &Value{value: C.value_array_next_get(v.value)}
231
232 val[i] = t.Interface()
233 t.Destroy()
234 }
235
236 return val
237}
238
239// Map returns the internal PHP value as a map of interface types, indexed by
240// string keys. Non-array values are implicitly converted to single-element maps

Callers 5

InterfaceMethod · 0.95
MapMethod · 0.95
TestValueSliceFunction · 0.95
engineReceiverNewFunction · 0.80
engineReceiverCallFunction · 0.80

Calls 2

InterfaceMethod · 0.95
DestroyMethod · 0.95

Tested by 1

TestValueSliceFunction · 0.76