Search found 2 matches

by karlmdv
Wed Jan 12, 2005 8:26 pm
Forum: PHP - Code
Topic: Function redeclaration error, from another instance.
Replies: 3
Views: 266

Functions inside functions are allowable. From the php manual, language.functions.html Example 17-3. Functions within functions <?php function foo() &#123; function bar() &#123; echo "I don't exist until foo() is called.\n"; &#125; &#125; /* We can't call bar() yet since it...
by karlmdv
Wed Jan 12, 2005 6:46 pm
Forum: PHP - Code
Topic: Function redeclaration error, from another instance.
Replies: 3
Views: 266

Function redeclaration error, from another instance.

The following code gives the error "Fatal error: Cannot redeclare bar() (previously declared in /var/www/htdocs/tmp/tmp.php:6) in /var/www/htdocs/tmp/tmp.php on line 5" I believed that the function bar() would be out of scope. Am I misunderstading something about scope? Generally though wh...