File: constants.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (47 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--TEST--
Math constants
--INI--
precision=-1
--FILE--
<?php
$constants = array(
    "M_E",
    "M_LOG2E",
    "M_LOG10E",
    "M_LN2",
    "M_LN10",
    "M_PI",
    "M_PI_2",
    "M_PI_4",
    "M_1_PI",
    "M_2_PI",
    "M_SQRTPI",
    "M_2_SQRTPI",
    "M_LNPI",
    "M_EULER",
    "M_SQRT2",
    "M_SQRT1_2",
    "M_SQRT3"
);
foreach($constants as $constant) {
    printf("%-10s: %s\n", $constant, constant($constant));
}
?>
--EXPECT--
M_E       : 2.718281828459045
M_LOG2E   : 1.4426950408889634
M_LOG10E  : 0.4342944819032518
M_LN2     : 0.6931471805599453
M_LN10    : 2.302585092994046
M_PI      : 3.141592653589793
M_PI_2    : 1.5707963267948966
M_PI_4    : 0.7853981633974483
M_1_PI    : 0.3183098861837907
M_2_PI    : 0.6366197723675814
M_SQRTPI  : 1.772453850905516
M_2_SQRTPI: 1.1283791670955126
M_LNPI    : 1.1447298858494002
M_EULER   : 0.5772156649015329
M_SQRT2   : 1.4142135623730951
M_SQRT1_2 : 0.7071067811865476
M_SQRT3   : 1.7320508075688772