How to skip the 1st key in an array loop?

后端 未结 12 1374
情歌与酒
情歌与酒 2020-12-03 04:29

I have the following code:

if ($_POST[\'submit\'] == \"Next\") {
    foreach($_POST[\'info\'] as $key => $value) {
        echo $value;
    }
}

12条回答
  •  一向
    一向 (楼主)
    2020-12-03 04:46

    On a array filled with 1000 elements the difference is quite minimal.

    Test:

    ';
    
    $t2 = time() + microtime(true);
    
    for ($i = 0; $i < 1000; $i++)
    {
        skip($array);
    }
    
    var_dump((time() + microtime(true)) - $t2);
    ?>
    

    Output:

    float(0.23605012893677)

    float(0.24102783203125)

提交回复
热议问题