没有逻辑语句的花括号的目的是什么?

I had a piece of code not working as I intended.

The code was roughly like this:

foreach ($arrayOfIds as $iterId)
{
    if ($iterId === $unchangingId)
    {
        // ...
    }

}

The problem was that it was going into the if statement regardless of whether the IDs matched or not.

Then I noticed that my if statement was incorrectly declared, and actually looked like this:

if ($iterId === $unchangingId);
{
    // ...
}

That single semi colon gave me so much grief.

Now, I know how/why I didn't get a compiler or runtime error because of the if ($iterId === $unchangingId);

but I never knew you could have code inside 2 curly braces like that, without anything else.

I want to learn more about this, and what it gets used for, if anyone could elaborate on it I'd be extremely grateful!

if ($iterId === $unchangingId);
{
    // ...
}

This is two separate and unrelated constructs.

An if construct can take the form of:

if (expression) statement;

without curly braces when used with a single statement, and that statement doesn't have to have anything in it but the terminating semicolon. So

if ($iterId === $unchangingId);

is a complete, standalone thing which you're then following with the unrelated statement block wrapped in braces:

{
    // ...
}

which does nothing special, the contents are handled just as if the curly braces weren't there.

In Java a naked curly braced block has local scope. In PHP, it doesn't do anything.