3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function dlzka_rurok($miestnost_w, $miestnost_h, $rozostup) { $dlzka = 0; $dlhsie = ($miestnost_w>$miestnost_h? $miestnost_w: $miestnost_h); for($i=1; $i < ($dlhsie/($rozostup*2)); $i++) { $dlzka += $miestnost_w-($i*($rozostup*2)); $dlzka += $miestnost_h-($i*($rozostup*2)); } return ($dlzka*2); } $miestnosti = array( "Izba E" => array(375, 350, 15), "Izba D" => array(375, 362, 15), "Kupelka" => array(183, 248, 10), "Predsien" => array(184, 228, 15), "Kuchyna" => array(200, 350, 15), "Stredna obyvacka" => array(250, 400, 15), "Obyvacka" => array(200, 400, 15) ); foreach($miestnosti as $key => $value) { $celkova_dlzka = 0; $aktualna_dlzka = dlzka_rurok($value[0], $value[1], $value[2]); $celkova_dlzka += $aktualna_dlzka; echo $key.": ".($aktualna_dlzka/100)."m<br />"; } echo "-----------<br />Celkova dlzka rurok v dome: ".$celkova_dlzka/100."m";
Output for 5.4.0 - 5.4.10
Parse error: syntax error, unexpected '"m"' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /in/9AJ2c on line 36
Process exited with code 255.
Output for 5.3.0 - 5.3.20
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /in/9AJ2c on line 36
Process exited with code 255.