0
votes
1answer
88 views

Why does this function work even though the vars are different

$inumber1 = 10; $inumber2 = 20; function add($number1, $number2) { echo $number1 + $number2; } add($inumber1, $inumber2); I'm learning PHP coding for the first time and I'm ...
7
votes
4answers
1k views

When would dynamic scoping be useful?

With dynamic scoping, a callee can access the variables of its caller. Pseudo C code: void foo() { print(x); } void bar() { int x = 42; foo(); } Since I have never programmed in a ...
6
votes
18answers
2k views

What do you name functions/variables/etc when you can't think of a good name?

When you are defining a function/variable/etc and are not sure what to name it, what do you name it? How do you come up with a name? If you use a temporary name as a place-card until you give it it's ...