Friday, August 28, 2009

PHP Pitfalls: An array's pointer is reset when copied

Array's pointers are reset when the original array is logically copied and thus has 2+ reference counts internally. This doesn't happen if it is not logically copied.

$a = array("one", "two");
next($a);
var_dump(current($a)); //=> "two"
$b = $a;
var_dump(current($a)); // => "one"
?>

Tuesday, January 06, 2009

Today's Book: The Art of Multiprocessor Programming

The Art of Multiprocessor Programming is a new FIRST-READ book for concurrency study.

This book comprehensively presents the principles and tools available for programming multiprocessor machines. It is of immediate use to programmers working with the new architectures. The authors are the leaders in this research community. Sample programs are written in Java.