PHP - 不通过foreach循环的数组

$array = Array(1,2,3);
foreach ($array as $identifier => $values_arr);
{
     echo(123);
}

The result is 123 instead of 123123123.

What you have are actually two different segments of code.

The first:

foreach ($array as $identifier => $values_arr);

doesn't actually do anything, and is stopped.

And the second:

{echo (123);}

so the output is 123

to get into the foreach you will need to remove the semi-colon:

foreach ($array as $identifier => $values_arr){
     echo(123);
}

There is an extra colon on the end of the foreach line. The same issue often happens with if/else lines. I am posting this as I could not find the answer via Google search.