本文整理匯總了PHP中Str::alternator方法的典型用法代碼示例。如果您正苦於以下問題:PHP Str::alternator方法的具體用法?PHP Str::alternator怎麽用?PHP Str::alternator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Str
的用法示例。
在下文中一共展示了Str::alternator方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
<div class="panelContent">
<?php
echo \Form::open(array('action' => \Uri::admin('current'), 'method' => 'get', 'class' => 'filter_form'));
$margin = \Str::alternator('m_r_15', 'm_r_15', 'm_r_15', '');
$status = array('false' => 'All', '1' => 'Active', '0' => 'Inactive');
?>
<div class="row-fluid blue_filters">
<table class="blue_filters_table">
<tr>
<td>
<div class="filter_width <?php
echo $margin();
?>
">
<div class="double_select">
<?php
echo \Form::label('Status');
?>
<?php
echo \Form::select('status', \Input::get('status'), array('select' => 'Select') + $status, array('class' => 'toggle_dates select_init filter_width', 'onchange' => "show_dates(\$(this), 2, \$('.toggable_dates'));"));
?>
</div>
<div class="toggable_dates date_content" <?php
echo \Input::get('status') != '2' ? 'style="display: none;"' : '';
?>
>
<?php
echo \Form::label('Dates Active', null, array('class' => 'dateLabel'));
示例2: test_alternator
/**
* Test for Str::alternator()
*
* @test
*/
public function test_alternator()
{
$alt = Str::alternator('one', 'two', 'three');
$output = $alt();
$expected = 'one';
$this->assertEquals($output, $expected);
$output = $alt(false);
$expected = 'two';
$this->assertEquals($output, $expected);
$output = $alt();
$expected = 'two';
$this->assertEquals($output, $expected);
$output = $alt();
$expected = 'three';
$this->assertEquals($output, $expected);
$output = $alt();
$expected = 'one';
$this->assertEquals($output, $expected);
}