mardi 5 avril 2016

How to determine a value in condition PHP?

I have a code for determining a value of mathematics and physics.

->for math scores:
if value 0 - <50, then "Bad"

if value 50 - <75, then "enough"

if value 75 - <85, then "good"

if value 85 - <=100, "great"

->for physics scores:

if value 0 - <50, then "Bad"

if value 50 - <75, then "good"

if value 75 - <85, then "great"

if value 85 - <=100, "extraordinary"

if I enter physics scores=50 ,the result that I have like this:

"Your physics scores are bad"

and the source code:

   <?php
$value=50;
//choice:
$courses='physics'; //or 
$courses='math';

if($courses='math' and $value<50){
    $sentence_value='Your math scores are bad';}
elseif ($courses='physics') {
    $sentence_value='Your physics scores are bad';}
elseif
    ($courses='math' and $value<75){
    $sentence_value='Your math scores are enough';}
elseif ($courses='pyhsics') {
    $sentence_value='Your physics scores are good';}
elseif
    ($courses='math' and $value<85){
    $sentence_value='Your math scores are good';}
elseif ($courses='physics') {
    $sentence_value='Your physics scores are great';}
elseif
    ($courses='math' and $value<=100){
    $sentence_value='Your math scores are great';}
elseif ($courses='physics') {
    $sentence_value='Your physics scores are extraordinary';}

echo"Value : $sentence_value";
?>
<br />

And the result, if I enter math scores by 50 points, that i want like this::

"Your math scores are bad" 

if I enter math scores by 70 points, that i want like this:

"Your math scores are enough"

if I enter math scores by 80 points, that i want like this:

"Your math scores are good"

if I enter math scores by 100 points, that i want like this:

"Your math scores are great"

if I enter physics scores by 50 points, that i want like this:

"Your math scores are bad"

if I enter physics scores by 74 points, that i want like this:

"Your math scores are good"

if I enter physics scores by 83 points, that i want like this:

"Your math scores are great"

if I enter physics scores by 98 points, that i want like this:

"Your math scores are extraordinary"

Aucun commentaire:

Enregistrer un commentaire