选择语言 :

 Core_Text::alternate

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
File: ./core/classes/text.class.php
public static function alternate()
{
    static $i = null;

    if (func_num_args() === 0)
    {
        $i = 0;
        return '';
    }

    $args = func_get_args();
    return $args[($i ++ % count($args))];
}