3v4l.org

run code in 300+ PHP versions simultaneously
<?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]');
Output for git.master, git.master_jit, rfc.property-hooks
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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.17 ms | 401 KiB | 8 Q