3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $input = <<<EOT battery.charge: 100 battery.runtime: 603 battery.type: PbAc device.mfr: EATON device.model: 5E 650i device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.synchronous: no driver.version: 2.7.4 driver.version.data: MGE HID 1.39 driver.version.internal: 0.41 input.voltage: 223.0 outlet.1.status: on outlet.desc: Main Outlet outlet.id: 1 outlet.switchable: no output.frequency: 49.9 output.frequency.nominal: 50 output.voltage: 220.0 output.voltage.nominal: 230 ups.beeper.status: enabled ups.delay.shutdown: 20 ups.firmware: 02.06.0017 ups.load: 40 ups.mfr: EATON ups.model: 5E 650i ups.power.nominal: 650 ups.productid: ffff ups.start.battery: yes ups.status: OL ups.timer.shutdown: -1 ups.vendorid: 0463 EOT; $output = explode("\n", $input); print_r(array_reduce($output, function($carry, $line) { list($key, $value) = explode(":", $line, 2); $carry[trim($key)] = trim($value); return $carry; }, []));
based on Wnf5b
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.2.6
Array ( [battery.charge] => 100 [battery.runtime] => 603 [battery.type] => PbAc [device.mfr] => EATON [device.model] => 5E 650i [device.type] => ups [driver.name] => usbhid-ups [driver.parameter.pollfreq] => 30 [driver.parameter.pollinterval] => 2 [driver.parameter.port] => auto [driver.parameter.synchronous] => no [driver.version] => 2.7.4 [driver.version.data] => MGE HID 1.39 [driver.version.internal] => 0.41 [input.voltage] => 223.0 [outlet.1.status] => on [outlet.desc] => Main Outlet [outlet.id] => 1 [outlet.switchable] => no [output.frequency] => 49.9 [output.frequency.nominal] => 50 [output.voltage] => 220.0 [output.voltage.nominal] => 230 [ups.beeper.status] => enabled [ups.delay.shutdown] => 20 [ups.firmware] => 02.06.0017 [ups.load] => 40 [ups.mfr] => EATON [ups.model] => 5E 650i [ups.power.nominal] => 650 [ups.productid] => ffff [ups.start.battery] => yes [ups.status] => OL [ups.timer.shutdown] => -1 [ups.vendorid] => 0463 )