To read an array from the device back to the host, one calls
clEnqueueReadBuffer($queue, $memobj, $blocking, $offset, $size, $target, 0, null, null);
The $queue is the CommandQueue which was used to allocate the memory on the device. The $memobj contains the address to the device memory, $offset...