-
-
Save alexandresalome/290291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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