zend-engine

In PHP, when foo = new Foo(), technically speaking, is foo an object, or is foo a reference?

Update: in http://php.net/manual/en/language.oop5.references.php it says: One of the key-points of PHP5 OOP that is often mentioned is that "objects are passed by references by default". This is not completely true. Why is that? The following is a reason which I don't know is completely true or not: I think loosely ...

Why don't PHP attributes allow functions?

I'm pretty new to PHP, but I've been programming in similar languages for years. I was flummoxed by the following: class Foo { public $path = array( realpath(".") ); } It produced a syntax error: Parse error: syntax error, unexpected '(', expecting ')' in test.php on line 5 which is the realpath call. But this works ...

PHP Performance : Copy vs. Reference

Hey there. Today I wrote a small benchmark script to compare performance of copying variables vs. creating references to them. I was expecting, that creating references to large arrays for example would be significantly slower than copying the whole array. Here is my benchmark code: <?php $array = array(); for($i=0; $i<100000; ...