1--TEST-- 2Static variables in methods & nested functions & evals. 3--FILE-- 4<?php 5 6Class C { 7 function f() { 8 static $a = array(1,2,3); 9 eval(' static $k = array(4,5,6); '); 10 11 function cfg() { 12 static $a = array(7,8,9); 13 eval(' static $k = array(10,11,12); '); 14 var_dump($a, $k); 15 } 16 var_dump($a, $k); 17 } 18} 19$c = new C; 20$c->f(); 21cfg(); 22 23Class D { 24 static function f() { 25 eval('function dfg() { static $b = array(1,2,3); var_dump($b); } '); 26 } 27} 28D::f(); 29dfg(); 30 31eval(' Class E { function f() { static $c = array(1,2,3); var_dump($c); } }'); 32$e = new E; 33$e->f(); 34 35?> 36--EXPECTF-- 37array(3) { 38 [0]=> 39 int(1) 40 [1]=> 41 int(2) 42 [2]=> 43 int(3) 44} 45array(3) { 46 [0]=> 47 int(4) 48 [1]=> 49 int(5) 50 [2]=> 51 int(6) 52} 53array(3) { 54 [0]=> 55 int(7) 56 [1]=> 57 int(8) 58 [2]=> 59 int(9) 60} 61array(3) { 62 [0]=> 63 int(10) 64 [1]=> 65 int(11) 66 [2]=> 67 int(12) 68} 69array(3) { 70 [0]=> 71 int(1) 72 [1]=> 73 int(2) 74 [2]=> 75 int(3) 76} 77array(3) { 78 [0]=> 79 int(1) 80 [1]=> 81 int(2) 82 [2]=> 83 int(3) 84} 85