PHP Online Compiler
Example: PHP program to find the area of a triangle if base and height are given
C
C++
C#
Java
Python
PHP
main.php
STDIN
Run
<?php // PHP program to find the area of a triangle if base and height are given $b = 5; $h = 7; $a = NULL; // b = base // h = height // a = area // Calculate area of the triangle $a = (float)(($b * $h) / 2); // Output echo "\nArea of the triangle = " . $a . " sq. units"; ?>
Output
Clear
ADVERTISEMENTS