3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $battery = "280"; $voltage_full = 320; // old hardware 100; $voltage_empty = 240; // old hardware 75; $voltage_range = $voltage_full - $voltage_empty; $battery_range = $battery – $voltage_empty; $battery = (int) $battery; if ( $battery >= $voltage_full ){ $battery_percentage = 100; } else { if ( $battery <= 240 ) { $battery_percentage = 0; } else { $battery_percentage = (100 * ($battery_range / $voltage_range)); } }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '–' (T_STRING) in /in/uP5KJ on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/uP5KJ on line 7
Process exited with code 255.