1;
}
echo s();
//as
});
Result:
1
Why doesn't work global $a in s fucntion?
function can't acces on global var. you have to pass it into the function
Try this: $a = 0; function A($fun){ $fun(); } function s() { global $a; return $a + 1; } function b() { global $a; $a = 22; echo s(); } A(b());
Обсуждают сегодня