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

Function NewValueFromPtr

engine/value.go:155–170  ·  view source on GitHub ↗

NewValueFromPtr creates a Value type from an existing PHP value pointer.

(val unsafe.Pointer)

Source from the content-addressed store, hash-verified

153
154// NewValueFromPtr creates a Value type from an existing PHP value pointer.
155func NewValueFromPtr(val unsafe.Pointer) (*Value, error) {
156 if val == nil {
157 return nil, fmt.Errorf("Cannot create value from 'nil' pointer")
158 }
159
160 ptr, err := C.value_new()
161 if err != nil {
162 return nil, fmt.Errorf("Unable to create new PHP value")
163 }
164
165 if _, err := C.value_set_zval(ptr, (*C.zval)(val)); err != nil {
166 return nil, fmt.Errorf("Unable to set PHP value from pointer")
167 }
168
169 return &Value{value: ptr}, nil
170}
171
172// Kind returns the Value's concrete kind of type.
173func (v *Value) Kind() ValueKind {

Callers 4

engineReceiverNewFunction · 0.85
engineReceiverSetFunction · 0.85
engineReceiverCallFunction · 0.85
EvalMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected