Alternates between two or more strings.
echo Text::alternate('one', 'two'); // "one" echo Text::alternate('one', 'two'); // "two" echo Text::alternate('one', 'two'); // "one"
Note that using multiple iterations of different strings may produce unexpected results.
string Core_Text::alternate( )
string
public static function alternate()
{
static $i = null;
if (func_num_args() === 0)
{
$i = 0;
return '';
}
$args = func_get_args();
return $args[($i ++ % count($args))];
}