Advertisement
Hydrase

CSV Numbers

Jun 7th, 2025
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Mean Result</title>
  5. </head>
  6. <body>
  7. <?php
  8. if(isset($_POST['numbers'])){
  9. $input=$_POST['numbers'];
  10. $array = explode(",", $input);
  11. $sum = 0;
  12. $count = count($array);
  13.  
  14. for ($i = 0; $i < $count; $i++) {
  15. $sum += $array[$i];
  16. }
  17.  
  18. $mean = $sum / $count;
  19. echo "The Mean is: " . $mean;
  20. } else {
  21. echo "No input received.";
  22. }
  23. ?>
  24. </body>
  25. </html>
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement