Skip to content

Instantly share code, notes, and snippets.

@alexandresalome
Forked from ubermuda/test.php
Created January 30, 2010 00:19
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 alexandresalome/290291 to your computer and use it in GitHub Desktop.
Save alexandresalome/290291 to your computer and use it in GitHub Desktop.
<?
class Car
{
publc function __construct($id)
{
$this->id = $id;
}
/**
* Get the max speed
*
* @return int Returns the max speed (or FALSE if unknown)
*/
function getMaxSpeed()
{
switch ($this->getType())
{
case 'sport':
$max = 230;
break;
case '1980':
$max = 120;
break;
default:
$max = false;
}
mysql_query('UPDATE car SET max = '.$max.' WHERE id = '.$this->getId());
return $max;
}
public function getType()
{
return $this->type;
}
public function setType()
{
$this->type = $type;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment