3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function calculateAccuracy($txPower, $rssi){ if ($rssi == 0) { return -1.0; // if we cannot determine accuracy, return -1. } $ratio = $rssi*1.0/$txPower; if ($ratio < 1.0) { return pow($ratio,10); } else { $accuracy = (0.89976)*pow($ratio,7.7095) + 0.111; return $accuracy; } } echo(calculateAccuracy(-10, -70).PHP_EOL); echo(calculateAccuracy(-20, -70).PHP_EOL); echo(calculateAccuracy(-40, -70).PHP_EOL); echo(calculateAccuracy(-60, -70).PHP_EOL); echo(calculateAccuracy(-80, -70).PHP_EOL); echo(calculateAccuracy(-90, -70).PHP_EOL); echo(calculateAccuracy(-100, -70).PHP_EOL);
based on VVY1l
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
2947202.9144146 14080.649683179 67.382098337306 3.0639286725642 0.26307557616383 0.081013110222412 0.0282475249
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 18 2947202.9144146PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 19 14080.649683179PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 20 67.382098337306PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 21 3.0639286725642PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 22 0.26307557616383PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 23 0.081013110222412PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/oYaiT on line 24 0.0282475249PHP_EOL