本文整理汇总了PHP中Card::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::render方法的具体用法?PHP Card::render怎么用?PHP Card::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Card
echo $deck->getNumCards();
echo '<hr />';
$deck->testFunction();
echo '<hr />';
//instantiate cards
$ten = new Card('hearts', 10);
$ace = new Card('spades', 1);
$jack = new Card('diamonds', 11);
$queen = new Card('clubs', 12);
$king = new Card('hearts', 13);
//render cards
$ten->render();
$ace->render();
$jack->render();
$queen->render();
$king->render();
//var_dump protected properties
echo '<h2>10 of Hearts</h2>';
$ten->testFunction();
echo '<h2>Ace of Spades</h2>';
$ace->testFunction();
echo '<h2>Jack of Diamonds</h2>';
$jack->testFunction();
echo '<h2>Queen of Clubs</h2>';
$queen->testFunction();
echo '<h2>King of Hearts</h2>';
$king->testFunction();
} catch (Exception $e) {
//Print the exception message
echo $e->getMessage();
}
示例2: assignIcon
// $this->color = "Black";
// }
$this->color = in_array($this->suite, array('D', 'H')) ? "Red" : "Black";
}
/**
* Assign the appropriate HTML entity icon to this card
* @return void
*/
protected function assignIcon()
{
switch ($this->suite) {
case 'D':
$this->icon = '♦';
break;
case 'H':
$this->icon = '♥';
break;
case 'C':
$this->icon = '♣';
break;
case 'S':
$this->icon = '♠';
break;
}
}
}
$card = new Card(10, 'D');
echo $card->render();
$card = new Card(3, 'S');
echo $card->render();