File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / closure_037.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:36 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
Closure 037: self:: and static:: within closures
--FILE--
<?php
class A {
	private $x = 0;

	function getClosure () {
			return function () {
				$this->x++;
				self::printX();
				self::print42();
				static::print42();
			};
	}

	function printX () {
		echo $this->x."\n";
	}

	function print42() {
		echo "42\n";
	}
}

class B extends A {
	function print42() {
		echo "forty two\n";
	}
}

$a = new A;
$closure = $a->getClosure();
$closure();
$b = new B;
$closure = $b->getClosure();
$closure();
?>
Done.
--EXPECTF--
1
42
42
1
42
forty two
Done.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>