This topic is locked
[SOLVED]

 Code Snippet Problem

11/5/2019 7:50:15 AM
PHPRunner General questions
HJB author
function distance($lat1, $lon1, $lat2, $lon2, $unit) {

if (($lat1 == $lat2) && ($lon1 == $lon2)) {

return 0;

}

else {

$theta = $lon1 - $lon2;

$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));

$dist = acos($dist);

$dist = rad2deg($dist);

$miles = $dist * 60 * 1.1515;

$unit = strtoupper($unit);
if ($unit == "K") {

return ($miles * 1.609344);

} else if ($unit == "N") {

return ($miles * 0.8684);

} else {

return $miles;

}

}

}
echo distance(32.9697, -96.80322, 29.46786, -98.53506, "M") . " Miles
";

echo distance(32.9697, -96.80322, 29.46786, -98.53506, "K") . " Kilometers
";

echo distance(32.9697, -96.80322, 29.46786, -98.53506, "N") . " Nautical Miles
";
?>


Could inject the code snippet with PHPR built-in CHECK SYNTAX to be okay, yet on testing,

I get an error window, saying, .../include/events.php owns a failure on line 63 which, after

inspection had been showing me that some additional three lines had been added, what do I miss?

K
keithh0427 11/5/2019

Try using "elseif" instead of "else if"

HJB author 11/5/2019



Try using "elseif" instead of "else if"


Many thanx, tested it, yet "Parse error: snytax error, unexpected end of file in .... \include\events.php on line 73" persists.

By the way, it would be premature at this stage to talk "Inspirunner" based hosting to let a big worldwide chunk of airport

latitudes and longitudes to appear under most easy search method by dashboard mapping as per demo under:
https://xlinesoft.com/livedemo/phprunner/livedemo81/Dashboard_map_dashboard.php
or say, basing on a known $75 hourly work rate (min 2 hours) by admin's team, some trigger-happiness is already felt at my end anyway.
As usual, biggest headache is to formulate a proper monthly access fee, as a lot of sharks are already in the aviation information

market by now, yet I'm sure that things can be properly sorted out as and when …
P.S. Luckily, the banner advertising in between the rows code snippet had been successfully tested to work under v10.3, so,

when the right time has come either "Inspirunner" or for interested airline runners (seats booking code snippet injection to

come later on) is my ACE in hands I want to play out then once striking a deal with SERGEY. Semi-professional competitor here

reports 4 Million site hits a year, with 200k a month from the private sector alone. Metamorphosing from APP maker status into

Google like income arena by Advertising? Well, one should at least give a try ….

HJB author 11/5/2019

Turned back to the roots now, say, switched from inaccurate HAVERSINE method based PHP code snippet to accurate VINCENTY Excel based formula results to then upload static results into the web app then from our main database tool.