I and Jim O'Brien have made two snippets of code, which do exactly the same. But which is faster?
(The code makes key-value pairs of even and odd numbers of the input array. If the input array is this:
Array(
    "thirteen",
    13,
    "seven",
    7,
    ...
)
then the output array will become this:
Array(
    "thirteen" => 13,
    "seven" => 7,
    ...
)
Snippet 1:
<?php
$output = array();
for ($i = 0; $i < count($input); $i++) {
    $output[$input[$i]] = $input[++$i];
}
?>
Snippet 2:
<?php
$output = array();
for ($i = 0; $i < count($input); $i += 2) {
    $output[$input[$i]] = $input[$i + 1];
}
?>
Which snippet is faster, and why?
 
     
     
     
     
     
    