Implicit Evaluation with PHP

Implicit Evaluation with PHP Archives: November 2005

·

30 November 2005

Combining Implicit Evaluation of Objects with Accessing Arrays

It turns out, that while you can preform implicit evaluation of an object, or a variable, or a variable’s associative array members, trying to merge them all has unexpected behavior.

class foo {
var $arr1;
var $arr2;
}
$foo = new foo();
$foo->arr1 = array(5);
$foo->arr2 = array(5);
function accessFirstElement ($object, $property) {
echo $object->$property[0];
}
accessFirstElement ($foo, “arr1″);
In writing this, I would expect PHP to […]

continue reading... » 0 Comments

·