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 = (int) $battery; $battery_range = $battery - $voltage_empty; if ( $battery >= $voltage_full ){ $battery_percentage = 100; } else { if ( $battery <= 240 ) { $battery_percentage = 0; } else { $battery_percentage = (100 * ($battery_range / $voltage_range)); } } echo $battery_percentage
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/3YpgQ on line 22
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/3YpgQ on line 22
Process exited with code 255.