To find the surface area of a triangular prism in PHP, you need to first know the formula. The formula for the surface area of a triangular prism is:
SA = 2*(0.5bh) + L*(a+b+c)
Where SA is the surface area, L is the length, a, b, and c are the sides of the triangle base, b is the triangle base and h is the height of the triangle.
To calculate the surface area of a triangular prism in PHP, you can create a function that takes the length, the triangle base, and the height of the triangle as arguments. Here is an example implementation of the function:
main.php422 chars13 lines
Then, you can call the function by passing the values of the length, triangle base, and height of the triangle:
main.php130 chars4 lines
This will output:
main.php60 chars2 lines
gistlibby LogSnag