Slice returns the internal PHP value as a slice of interface types. Non-array values are implicitly converted to single-element slices.
()
| 221 | // Slice returns the internal PHP value as a slice of interface types. Non-array |
| 222 | // values are implicitly converted to single-element slices. |
| 223 | func (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 |