-1

I'm building a grading system and I want "+" and "/"

like this :

for example: c71st="89" c72nd="90" c73rd="89" c74th="70"

<?php echo $userinfo['c71st'] ?> + <?php echo $userinfo['c71st'] ?> + <?php 
echo $userinfo['c71st'] ?> + <?php echo $userinfo['c71st'] ?> /2

how can I add and divide this ? when I type + it only display + sign in php form or html

this is different from other questions

  • 1
    Possible duplicate of [Reference - What does this symbol mean in PHP?](http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – LF00 May 03 '17 at 04:32

2 Answers2

0

just add and divide them on php. not in html or javascript

<?php echo ($userinfo['c71st'] + $userinfo['c71st'] + $userinfo['c71st'])/2; ?>
Chinito
  • 1,085
  • 1
  • 9
  • 11
0

First You have to create $userinfo array

<?php
    $userinfo = array("c71st"=> 89, "c72nd"=> 90, "c73rd"=> 89, "c74th"=> 70);
    echo ($userinfo['c71st'] + $userinfo['c71st'] + $userinfo['c71st'] + $userinfo['c71st']) / 2 ;
    ?>
Aman Kumar
  • 4,533
  • 3
  • 18
  • 40