<?php
class Currency
{
public $currencyCode;
public function __construct($currencyCode)
{
$this->currencyCode = $currencyCode;
}
public function equals(Currency $currency)
{
return $this->currencyCode === $currency->currencyCode;
}
}
class Money
{
public $amount;
public $currency;
public function __construct($amount, Currency $currency = null)
{
$this->currency = $currency ?: new Currency('USD');
}
}
$revenue = new Money(55, new Currency('GBP'));
var_dump($revenue->currency->equals(new Currency('GBP')));
Parse error: syntax error, unexpected ':' in /in/CA16S on line 25
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected ':' in /in/CA16S on line 25
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/CA16S on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/CA16S on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/CA16S on line 5
Process exited with code 255.