New to Php


#1

hi people im new to php programming i have a big problem i wanna assign to variables my name and a mark (between 1-25). And Convert this mark out of 25 to a percentage. If the percentage is 70% or more print out the statement, with my name on and sayin you are a first class student!?
but i donno how to start it off so could some start it off for us please thank you


#2

You would have a file looking something like this…

<?php

$name = "John Doe";
$mark = 17;

$percentage = 17 / 25 * 100;

if( $percentage >= 70 )
{
    print $name . " is a first class student!";
}

?>

You’ll probably want to look up sprintf at http://php.net to do some formatting on the percentage, otherwise it will have quite a few decimal places.