[PHP] static variables inside static methods

2011-07-06 Thread Дмитрий Степанов
Hello, everybody. While working with static variables inside static class' methods, I have found this very interesting (at least for me) behavior of PHP. Consider the following class definitions (example #1): class X { public final static function test() { static $i; return ++$i; } } class Y

Re: [PHP] static variables inside static methods

2011-07-06 Thread Дмитрий Степанов
outside the test method. The second case is referencing the varible of the class. 2011/7/6 Дмитрий Степанов dmit...@stepanov.lv Hello, everybody. While working with static variables inside static class' methods, I have found this very interesting (at least for me) behavior of PHP

[PHP] Import symbol table into function' scope.

2011-06-15 Thread Дмитрий Степанов
Hello, everybody. Consider the following code: class DB { public function query( $sql) { // ... some magic of DB querying } } class DBReader { public $DB;// instance of DB public function __call( $methodName, $args) { return call_user_func_array( array( $this, $methodName), $args); } protected