hey,
you should view this
a drag and drop script using DOM
Thursday, February 14, 2008
php area (command line)
hi,
i am an open source coder.
here is a command line php code that find area of different shapes.
i am an open source coder.
here is a command line php code that find area of different shapes.
function findarea($shape,$m1,$m2) {
if($shape=='rectangle') {
$a = $m2*$m1;
echo $a;
return $a;
}
else if($shape=='square') {
$a = $m1*$m2;
echo $a;
return $a;
}
else if($shape=='triangle') {
$a = $m1*$m2;
echo $a;
return $a;
}
else {
echo "wrong shape";
}
}
// Now we do the input task on the command line
echo "Enter l an b of a rectangle";
$l = fgets(STDIN);
$b = fgets(STDIN);
findarea(rectangle,$l,$b);
?>
Subscribe to:
Comments (Atom)
