The scenario is as follows, the student takes the exam and according to the exam result, the system defines it to the training package. To do this, we define the score and package number in the database beforehand.

The first thing we need is a variable where we will specify the student's score. $point // Student score $points = json_decode(getSiteOptions('sbsJson'), true); // It is getting the above mentioned json data from my setting. $point = 45; // Student score $data = []; $points = json_decode(getSiteOptions('sbsJson'), true); $point = 45; foreach ($points as $a) { $parcala = explode('-', $a['score']); if ($parcala !== "") { $parcala = ((int) trim($parcala)) === 0 ? -1 : $parcala; if ($parcala $a['package'], 'sbs_price' => $a['price']]; }} else { if ($point $a['package'], 'sbs_price' => $a['price']]; }} } return $data; It's working pretty well for me now, I'm waiting for your comments if we can fix it with a shorter code... :)
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners