← All built-ins / malloc()
malloc()
unsafemalloc(int $n): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $n | int | byte count |
Return value
Raw pointer to n bytes (unsafe block required). Free with free().
Example
echo "// unsafe { $p = malloc(1024); memset($p, 0, 1024); free($p); }";// unsafe { $p = malloc(1024); memset($p, 0, 1024); free($p); }This call needs a real environment (window, server, database or stdin) — the snippet above shows the typical usage shape.