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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners