Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2012 00:53
Show Gist options
  • Save anonymous/4128773 to your computer and use it in GitHub Desktop.
Save anonymous/4128773 to your computer and use it in GitHub Desktop.
IT"S EVEN MORE BEAUTIFUL
<?php
class Question {
public $questionName;
public $choiceValue;
public function __construct($questionName, $choiceValue){
$this->choiceValue = $choiceValue;
if($questionName == "1"){
$name = "hate";
}
else if ($questionName == "2"){
$name = "don't prefer";
}
else if ($questionName == "3"){
$name = "are ok with";
}
else if ($questionName == "4"){
$name = "awesome is the word for";
}
else {
$name = "love";
}
$this->questionName = $name;
}
public static function cmp_obj($a, $b)
{
$al = $a->choiceValue;
$bl = $b->choiceValue;
if ($al == bl) {
return 0;
}
return ($al > bl) ? +1 : -1;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment