Exemplo n.º 1
0
 /**
  * @param array $tx
  *
  * @return string
  * @throws \Exception
  */
 public static function getTransactionType(array $tx)
 {
     switch (true) {
         case isset($tx['order']) && \Bc::comp($tx['amount'], 0) === -1:
             return self::TX_TYPE_HOLD;
             break;
         case $tx['type'] === 'cancel':
             return self::TX_TYPE_RETURN;
             break;
         case $tx['type'] === 'buy':
             return self::TX_TYPE_BUY;
             break;
         case $tx['type'] === 'sell':
             return self::TX_TYPE_SELL;
             break;
         default:
             throw new \Exception('Unknown transaction type');
     }
 }
Exemplo n.º 2
0
<?php

class Bc
{
    function __construct($a, $b)
    {
        $this->a = $a;
        $this->b = $b;
    }
    function summa()
    {
        echo $this->a + $this->b;
    }
}
?>

<?php 
$one = $_POST['one'];
$two = $_POST['two'];
$object = new Bc($one, $two);
?>

<form action="./class.php" method="post">
    <input type="text" name="one"> <input type="submit" value="плюс"> <input type="text" name="two"> = <?php 
echo $object->summa();
?>
</form>