3v4l.org

run code in 300+ PHP versions simultaneously
<?php $battery = "280"; $voltage_full = 320; // old hardware 100; $voltage_empty = 240; // old hardware 75; $voltage_range = $voltage_full - $voltage_empty; $batteryint = (int) $battery; $battery_range = $batteryint – $voltage_empty; 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/YHAKg on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/YHAKg on line 8
Process exited with code 255.

preferences:
181.06 ms | 1395 KiB | 65 Q