From Evrim Altay, 3 Months ago, written in PHP.
Embed
  1. <?php
  2. /***********************************************
  3.  * Hc-Sr04 Sıcaklığa Göre Ses Hızı Hesaplayıcı
  4.  *
  5.  * Kodlama: Evrim Altay KOLUAÇIK
  6.  * Hesap Makinesi: https://cl.rimtay.com/hcsr04tr
  7.  *
  8.  * Calculator: https://cl.rimtay.com/fvvnj
  9.  ***********************************************
  10.  */
  11.  
  12. $temperature = $_GET['temperature'];
  13.  
  14. if(!is_numeric($temperature)){
  15.         echo json_encode(["status" => "error", "errType" => 1]);
  16.         exit;
  17. }
  18.  
  19. if($temperature < -80 || $temperature > 100){
  20.         echo json_encode(["status" => "error", "errType" => 2]);
  21.         exit;
  22. }
  23.  
  24. $speedOfSound = number_format(1 / (331.3 * sqrt(1 + ($temperature / 273.15)) / 10000),4);
  25.  
  26. echo json_encode(["status" => "success", "speedOfSound" => $speedOfSound]);