Skip to content

Instantly share code, notes, and snippets.

@AstonJ
Created May 13, 2011 19:12
Show Gist options
  • Save AstonJ/971119 to your computer and use it in GitHub Desktop.
Save AstonJ/971119 to your computer and use it in GitHub Desktop.
PHP
<?
class Ball
{
private $_colour;
public function __construct($colour)
{
$this->_colour = $colour;
}
public function is_red()
{
return ($this->_colour == 'red' ? true : false);
}
}
$the_ball = new Ball('green');
echo ($the_ball->is_red() ? '' : 'The ball is not red');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment