Skip to content

Instantly share code, notes, and snippets.

@tassoevan
Created May 28, 2014 12:55
Show Gist options
  • Save tassoevan/1730c5890941a339c38d to your computer and use it in GitHub Desktop.
Save tassoevan/1730c5890941a339c38d to your computer and use it in GitHub Desktop.
<?php
function galvao(array $a) {
$b = array('e', array_pop($a));
echo implode(', ', $a) . ' ' . implode(' ', $b);
}
function tassoevan(array $times) {
echo implode(', ', array_slice($times, 0, -1)), ' e ', end($times);
}
$times = array('Chelsea', 'Liverpool', 'Manchester United', 'Manchester City');
for ( ; ; ) {
$start = microtime(true);
galvao($times);
echo "\ngalvao: ", microtime(true) - $start, "\n\n";
$start = microtime(true);
tassoevan($times);
echo "\ntassoevan: ", microtime(true) - $start, "\n\n";
sleep(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment