Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I was reading through some code in a forum I shall not name, and found this snippet:

$tempFile = '';
$tempFile2 = '';
$arrayLength = count($filesArr); 
{
    //some code
}

I'm by no means a php guru but those curly braces don't make alot of sense to me. Anyone know of some usage I'm not familiar with. <- please don't run with that XD

share|improve this question

closed as off topic by nickles80, Brian Reichle, svick, Jeff Vanzella, almaz Dec 18 '12 at 6:41

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
This question is off topic. Code Review is for sharing code from projects you are working on for peer review. Please consult the FAQ. –  nickles80 Dec 17 '12 at 20:21
add comment

1 Answer 1

up vote 1 down vote accepted

I'm not too familiar with PHP but in some languages (C++, Java, etc) braces have their own local scope, so variables can be created and used only within the braces. It seems in PHP only functions/methods have local scope, so those braces likely have no functional effect. They may be done for aesthetic purposes (like organizing a small block of code), or they might be a mistake. The only way to really be sure is by asking the person who wrote the code.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.