<?php $a = array(); $n = (int)fgets(STDIN); $mch1 = 101; $mch2 = 101; $mne1 = 101; $mne2 = 101; $min1 = 0; $min2 = 0; for($i=1;$i<=$n;$i++) { $x = (int)fgets(STDIN); if($x<0) { $sum = $sum + $x; if(($x%2 == 0)and($x < $mch1)) { $mch1 = $x; } if(($x%2 != 0)and($x < $mne1)) { $mne1 = $x; } } else if(x>0) { if(($x%2 == 0)and($x < $mch2)) { $mch2 = $x; } if(($x%2 != 0)and($x < $mne2)) { $mne2 = $x; } } if($sum%2 != 0) { } } if((($mch1 == 101)or($mch2 == 101))and(($mne1 == 101)or($mne2 == 101))) { echo 'NO'; } ?>
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php echo "<h1>delivered</h1>\n"; ?> </body> </html>
<?php $motorcycle_speed = 60; // km/h $motorcycleFuelTank = 5; // liters $motorcycle_fuel_consumptionRate = 10; # km/liter $carSpeed = 100; // km/h $carFuelTank = 40; // liters $car_fuel_consumptionRate = 8; # km/liter $busSpeed = 80; // km/h $busFuelTank = 200; // liters $bus_fuel_consumptionRate = 5; # km/liter function getTimeSpent($type ,$distance){ global $motorcycle_speed; global $carSpeed; global $busSpeed; if ($type=='motorcycle') { return $distance / $motorcycle_speed; } else if ($type=='car') { return $distance / $carSpeed; } else if ($type=='bus') { return $distance / $busSpeed; } else { return false; } } // Every vehicle starts with the full fuel tank. function getFuelStopNeed($type,$distance) { global $motorcycleFuelTank; global $motorcycle_fuel_consumptionRate; global $carFuelTank; global $car_fuel_consumptionRate; global $busFuelTank; global $bus_fuel_consumptionRate; if ($type=='motorcycle') { $time = floor($distance /($motorcycle_fuel_consumptionRate*$motorcycleFuelTank)); return ($time < 0) ? 0 : $time; } else if ($type=='car') { $time = floor($distance/( $car_fuel_consumptionRate* $carFuelTank)); return ($time < 0) ? 0 : $time; } else if ($type=='bus') { $time = floor($distance / ($bus_fuel_consumptionRate *$busFuelTank)); return ($time < 0) ? 0 : $time; } else { return false; } } $distance = 120; echo 'Distance: ' . $distance.'km(s)'; echo "\n"; $vehicle = 'motorcycle'; echo 'Vehicle: ' . ucfirst($vehicle) . ', Time spent: ' . getTimeSpent($vehicle, $distance) . 'hr(s), Fuel stop: ' . getFuelStopNeed($vehicle, $distance); echo "\n"; $vehicle = 'car'; echo 'Vehicle: ' . ucfirst($vehicle) . ', Time spent: ' . getTimeSpent($vehicle, $distance) . 'hr(s), Fuel stop: ' . getFuelStopNeed($vehicle, $distance); echo "\n"; $vehicle = 'bus'; echo 'Vehicle: ' . ucfirst($vehicle) . ', Time spent: ' . getTimeSpent($vehicle, $distance) . 'hr(s), Fuel stop: ' . getFuelStopNeed($vehicle, $distance); echo "\n"; ?>
<html> <head> <title>160120107073hw</title> </head> <body> <?php echo "<h1>Hello, PHP!</h1>\n"; ?> </body> </html>
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php $arr = [ 'Country1'=> ['state1'=> ['city1','city2','city3'], 'state2'=> ['city4','city5'] ], 'Country2'=> ['state3' => ['city6','city7'] ] ]; foreach($arr as $key => $value){ // echo $key;echo "<br/>"; foreach( $value as $k => $v ){ // echo $k;echo "<br/>"; foreach( $v as $k1 => $v1 ){ if( $v1 == 'city6'){ echo "FOUND city= ".$v1." COUNTRY =".$key."STATE = ".$k;echo "<br/>"; } } } } ?> </body> </html>
$url = "https://xc-outer-api.902t.com/apiouter-19"; $_Method['call'] = 'GetQqtyCatalog'; $_Content['Control' ] = 4; $_Content['page' ] = 1; $_Content['pagemax' ] = 10; $_Content['typeid' ] = 0; $output = implode('&', array_map( function ($v, $k) { return sprintf("%s=%s", $k, $v); }, $_Content, array_keys($_Content) )); $signkey = md5($output.'$t='.date("HisYmd").'&key=984c4d1f62abefd5b792d4907d08d226'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array("call"=>$_Method['call'], "content"=>$_Content, "signkey"=>$signkey ))); $output = curl_exec($ch); curl_close($ch); print_r($output);
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php $ar = "2 3 4 5"; $arr = explode(" ",$ar); print(implode(" ",$arr)); $no = (string)3; print(gettype($no)); ?> </body> </html>
<?php $array = [ "a" => 1, "b" => 2, "c" => 3 ]; $arrayShifted = array_rand($array); print_r($arrayShifted);
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', 1); $strArr = [ 'name'=>"test", 'is_feature'=> "0", 'attributes'=>[[5=> "blue"],[7=> "iOS"]], 'cost'=> "2000" ]; $str = json_encode($strArr); $arr = (array) json_decode($str); $att = (array) $arr['attributes']; foreach($att as $v) { foreach($v as $k=>$z) { echo "key: ".$k." and val: " . $z . PHP_EOL; } }; ?> </body> </html>
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <button>Button</button> <?php echo "<h1>Hello, PH21314w4q4qdfgdP!</h1>\n"; ?> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more