A parte il fatto che basta

codice:
echo pi();
per implementare quella formula:

codice:
<?php
$sign = 1;
$quot = 0;

for ($x = 1; $x < 2000; $x += 2) {
	$quot += $sign * 1/$x;
	$sign *= -1;
}

echo 4 * $quot;
?>