in connection with the presence of a great manual on php.net with comments, no reason to repeat it in the books, so any books surface for dummies, or associated with patterns and architecture.
I usually say that php should read two books — the first and schlossnagle (John.Schlossnagle "Professional PHP programming").
answer the questions, because you have bugs.
foreach uses a delayed copy, the variables are copied only when modified, but objects are passed by reference from version 5.0 For objects, you can connect the Iterator interface from SPL
Variables and objects are deleted when links to them stanovitsya 0, deleting triggers the __destruct in 5.3 appeared a garbage. but the main feature of php is that you should not try to remove the variables if it is not cli, then let php itself cleans everything at the end of the script, the overhead for this is not sensitive. Pro up need to know one useful feature — the extension can work with PMTU its costs and thereby limit memory_limit and the process starts to get fat, but memory_get_usage will be silent as the grave.
I worked with the developer of the programming to the pros. The main problem is re-optimized, which causes a lot of code, the code confusing and difficult to support, the worst — the constant desire to save money on associative arrays. Not counting cli applications, php, even with the goof coding will not eat all the RAM and the CPU, a weak spot — storadzh, width and speed of the data transmission channel. This is true for the vast majority of applications.
with questions better phpclub.ru we may not be the most friendly forum, but professional.