<?php $b = array_slice($b, $c, $d, C); $e = $f . $g . $h . $e . $i . $j; $k = apply_filters('E', $k, $l); $b = mySort($b, 'G', H); $b = B($b, 'J', K); $m = self::M($m, $n); $m = "{$nN}" . O('P', 'Q') . "R{$m}"; $m = static::M($m, $n); $o = implode('V', $o); $p = str_replace('X', 'Y', $p); $m = L::M($m, $n); $o = (array) $o;
<?php // configuration require "../includes/config.php"; $rows = CS50::query("SELECT college, img_URL, total FROM stats"); function mySort($array) { $sorted = []; $length = count($array); for ($i = 0; $i < $length; $i++) { $highest = 0; for ($j = 0; $j < $length; $j++) { if ($array[$j]["total"] > $array[$highest]["total"]) { $highest = $j; } } array_push($sorted, $array[$highest]); $array[$highest]["total"] = -1; } return $sorted; } $sorted = mySort($rows); // apologize("Sorry about that!"); render("home.php", ["title" => "Home", "sorted" => $sorted, "col_names" => $name]);
<?php $myArray = array(1, 5, 2, 8, 9, 5, 3, 7); mySort($myArray); function mySort($a) { echo "Unsorted "; print_r($a); $aLength = count($a); for ($j = 0; $j < count($a); $j++) { for ($i = 0; $i < count($a) - 1; $i++) { if ($a[$i] > $a[$i + 1]) { $temp = $a[$i + 1]; $a[$i + 1] = $a[$i]; $a[$i] = $temp; } } } echo "Sorted "; print_r($a); }
} $fv = mySort($fields, true); } //favorite weapon $query = "SELECT * FROM stats_w WHERE pid = '" . $data["pid_{$x}"] . "'"; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result)) { $pp = mysql_fetch_assoc($result); $params = "wtp-0 wtp-1 wtp-2 wtp-3 wtp-4 wtp-5 wtp-6 wtp-7 wtp-8 wtp-9 wtp-10 wtp-11 wtp-12 wtp-13 wtp-14 wtp-15 wtp-16 wtp-17 wtp-18 wtp-19 wtp-20 "; $params .= "wtp-21 wtp-22 wtp-23 wtp-24 wtp-25 wtp-26 wtp-27 wtp-28 wtp-29 wtp-30 wtp-31 wtp-32 wtp-33 wtp-34 wtp-35 wtp-36 wtp-37 wtp-38 wtp-39 wtp-40 wtp-41 wtp-42"; $params = explode(" ", $params); $fields = array(); foreach ($params as $param) { $fields[$param] = $pp[$param]; } $fw = mySort($fields, true); } $pquery = ""; if ($fgm) { $pquery .= "fgm=" . $fgm . ","; } if ($fm) { $pquery .= "fm=" . $fm . ","; } if ($fk) { $pquery .= "fk=" . $fk . ","; } if ($fv) { $pquery .= "fv=" . $fv . ","; } if ($fw) {
public function __construct($courseDesc, $courseCredits, $courseBarToEntry, $courseCore) { $this->courseDesc = $courseDesc; $this->courseCredits = $courseCredits; $this->courseBarToEntry = $courseBarToEntry; $this->courseCore = $courseCore; } } class APcourse extends Course { var $score; } //The part where shit happens //================================================ $courses = getCourses($major); mySort($courses); $courses2 = array(array()); //for each element in courses, it makes a new array in courses2, and fills it with one element from courses //makes a 2D array for ($x = 0; $x < count($courses); $x++) { array_push($courses2, array()); array_push($courses2[$x], $courses[$x]); } $courses2 = combineSimilar($courses2); $apCourses = getAPcredits($major); for ($q = 0; $q < count($apScores); $q += 2) { foreach ($apCourses as $r) { if ($apScores[$q] == $r->courseDesc) { $r->score = $apScores[$q + 1]; } }