If you create the function inside the loop, you're creating 300 individual anonymous function objects. PHP does not optimize this away, since maybe that's what you want. That's a lot less efficient than creating the function once before the loop.
Here's the proof that two independent objects get created: http://3v4l.org/f3cdE