3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $mypi = 3.1415926535897932384626433832795028841971; $mypi = 3.141592653589793; $pi = pi(); printf("pi: %.24f, %.24f, %.24f\n", $pi, $mypi, M_PI); $l = strlen($mypi); echo "l: $l\n"; $d = pack("d", $mypi); $l = strlen($d); echo "l: $l\n"; $un = unpack("d", $d); $d = end($un); printf("%.24g\n", $d); $pi = 3.1415926535897932384626433832795028841971; $s = preg_split("//", $pi); $c = count($s); print_r($s); echo "c: $c\n";
based on tLXBY
Output for 5.2.1 - 5.6.28, 7.0.0 - 7.1.0
pi: 3.141592653589793115997963, 3.141592653589793115997963, 3.141592653589793115997963 l: 15 l: 8 3.14159265358979311599796 Array ( [0] => [1] => 3 [2] => . [3] => 1 [4] => 4 [5] => 1 [6] => 5 [7] => 9 [8] => 2 [9] => 6 [10] => 5 [11] => 3 [12] => 5 [13] => 8 [14] => 9 [15] => 8 [16] => ) c: 17
Output for hhvm-3.10.0 - 3.12.0
pi: 3.141592653589800221425321, 3.141592653589793115997963, 3.141592653589800221425321 l: 15 l: 8 3.14159265358979311599796 Array ( [0] => [1] => 3 [2] => . [3] => 1 [4] => 4 [5] => 1 [6] => 5 [7] => 9 [8] => 2 [9] => 6 [10] => 5 [11] => 3 [12] => 5 [13] => 8 [14] => 9 [15] => 8 [16] => ) c: 17
Output for 4.3.0 - 5.2.0
pi: 3.141592653589793115997963, 3.141592653589793115997963, 3.141592653589793115997963 l: 15 l: 8 Array ( [0] => [1] => 3 [2] => . [3] => 1 [4] => 4 [5] => 1 [6] => 5 [7] => 9 [8] => 2 [9] => 6 [10] => 5 [11] => 3 [12] => 5 [13] => 8 [14] => 9 [15] => 8 [16] => ) c: 17