@ 2014-09-29T15:08:43Z <?php
function eho($what, $label)
{
echo "\n\n" . $label . ': ';
dump($what);
echo "\n\n";
}
function dump() {
$args = func_get_args();
return call_user_func_array('var_dump', $args);
}
function ehobool($b, $label)
{
eho($b ? 'true' : 'false', $label);
}
function CalculateRegularFenceCoords ($fCentreLat, $fCentreLon, $fRadius, $iVertices)
{
//$a = shell_exec(
// "node $shell_scripts_path/nodejs/calculate_regular_fence.js --www_path=$source_www_path " .
// "--lat=$fCentreLat --lon=$fCentreLon --radius=$fRadius --vertices=$iVertices"
//);
//eho($a, 'shell_exec');
$a = '{"lats":["56.998210","56.998210","56.998279","56.998414","56.998610","56.998859","56.999152","56.999478","56.999824","57.000176","57.000522","57.000848","57.001141","57.001390","57.001586","57.001721","57.001789","57.001789","57.001721","57.001586","57.001390","57.001141","57.000848","57.000522","57.000176","56.999824","56.999478","56.999152","56.998859","56.998610","56.998414","56.998279","56.998210"],"lons":["24.000324","23.999676","23.999042","23.998444","23.997906","23.997448","23.997088","23.996841","23.996714","23.996714","23.996841","23.997088","23.997448","23.997906","23.998444","23.999042","23.999676","24.000324","24.000958","24.001556","24.002094","24.002552","24.002912","24.003159","24.003286","24.003286","24.003159","24.002912","24.002552","24.002094","24.001556","24.000958","24.000324"]}';
$aFenceCoords = json_decode($a, true);
foreach ($aFenceCoords['lats'] as $i => $fLat) {
convert2($aFenceCoords['lats'][$i], $aFenceCoords['lons'][$i], $aFenceCoords['xes'][$i], $aFenceCoords['ys'][$i]);
}
return $aFenceCoords;
}
$actual = CalculateRegularFenceCoords(57, 24, 200, 32);
unset($actual['lats'], $actual['lons'], $actual['ys']);
for ($i = 0; $i <= 31; ++$i) {
unset($actual['xes'][$i]);
}
eho($actual, '$actual');
ehobool($actual["xes"][32] == 500019.68325692, '$actual["xes"][32] == 500019.68325692');
eho($actual["xes"][32], '$actual["xes"][32]');
$actual= array(
"xes"=>
array(
32=>
500019.68325692
)
);
eho($actual, '$actual');
ehobool($actual["xes"][32] == 500019.68325692, '$actual["xes"][32] == 500019.68325692');
eho($actual["xes"][32], '$actual["xes"][32]');
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Call to undefined function convert2() in /in/14D0K:30
Stack trace:
#0 /in/14D0K(36): CalculateRegularFenceCoords(57, 24, 200, 32)
#1 {main}
thrown in /in/14D0K on line 30
Process exited with code 255 . Output for 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.28 Fatal error: Call to undefined function convert2() in /in/14D0K on line 30
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 Fatal error: Call to undefined function json_decode() in /in/14D0K on line 27
Process exited with code 255 . Output for 4.4.5 - 4.4.9 Fatal error: Call to undefined function: json_decode() in /in/14D0K on line 27
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.4 Fatal error: Call to undefined function: json_decode() in /in/14D0K on line 27
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Call to undefined function: json_decode() in /in/14D0K on line 27
preferences:dark mode live preview
261.68 ms | 401 KiB | 399 Q