Example 1 — Basic acos() usage
This example finds the arc cosine of a few common values and rounds them so the output is easy to read.
<?php
echo round(acos(0.5), 4) . PHP_EOL;
echo round(acos(0), 4) . PHP_EOL;
echo round(acos(-1), 4) . PHP_EOL;
echo acos(1) . PHP_EOL; How It Works
- acos(0.5) is about 1.04719755 radians, and round(..., 4) shortens it to 1.0472.
- acos(0) is pi / 2, which rounds to 1.5708.
- acos(-1) is pi, which rounds to 3.1416.
- acos(1) is exactly 0, so PHP prints 0.

