Skip to content

Instantly share code, notes, and snippets.

@AstonJ
Created May 13, 2011 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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