MCPcopy Index your code
hub / github.com/php/frankenphp / PHPPackedArray

Function PHPPackedArray

types.go:248–257  ·  view source on GitHub ↗

EXPERIMENTAL: PHPPackedArray converts a Go slice to a PHP zval with a zend_array value.

(slice []T)

Source from the content-addressed store, hash-verified

246
247// EXPERIMENTAL: PHPPackedArray converts a Go slice to a PHP zval with a zend_array value.
248func PHPPackedArray[T any](slice []T) unsafe.Pointer {
249 zendArray := createNewArray((uint32)(len(slice)))
250 for _, val := range slice {
251 zval := phpValue(val)
252 C.zend_hash_next_index_insert(zendArray, zval)
253 C.__efree__(unsafe.Pointer(zval))
254 }
255
256 return unsafe.Pointer(zendArray)
257}
258
259// EXPERIMENTAL: GoValue converts a PHP zval to a Go value
260//

Callers 2

TestPHPPackedArrayFunction · 0.85

Calls 2

createNewArrayFunction · 0.85
phpValueFunction · 0.85

Tested by 2

TestPHPPackedArrayFunction · 0.68