foreach输出两个数组首先跳过[重复]

Possible Duplicate:
how to skip elements in foreach loop

I have the following foreach:

foreach($documents as $document): 
    print_r($document);
endforeach; 

Which outputs the following:

Array
(
    [num] => 2
)
Array
(
    [0] => Array
        (
            [name] => Batman
            [url] => http://batman.com
        )

    [1] => Array
        (
            [name] => Superman
            [url] => http://superman.com
        )

)

The first array conatining [num] => 2, I dont want to use in my foreach when printing the result.

But how do I get rid of that array so it doesn't get printed when I use write print_r($document)?

Keeping with the foreach you can use continue:

$first = true;

foreach($documents as $document) {
    if($first) {
        $first = false;
        continue;
    }

    print_r($document);
}

Use a standard for loop with an incrementing index specifier and skip the first element.

for($i = 1; $i < count($documents); $i++) {
  print_r($documents[i]);
}

The easiest approach would be to remove the first array completely, however my guess is that you can't do that. No worries - this should have you covered:

for( $i = 1; $i < count($documents); $i++ ):
   print_r($documents[$i]);
endfor;

Edit: I've created a test case for you on Codepad.org.