<?php
/* How many times the code under test should run in each function */
define('LOOP', 10);
define('MAX', 10);
function f1()
{
for ($i = 0; $i < LOOP; ++$i) {
// one liner array_map with anonymous function - 5.3+
return $array = array_map(function($d) { return 'count_' . $d; }, range(0, MAX));
}
}
function f2()
{
for ($i = 0; $i < LOOP; ++$i) {
// another (convoluted) one line approach, avoiding array_map - 5.2+
return $array = explode('#', 'count_' . implode('#count_', range(0, MAX)));
}
}
echo f1();