add values for PI and newline to library

This commit is contained in:
Pekka Laiho 2020-06-16 20:43:47 +07:00
parent 427327003d
commit 0ecc4a7b73
2 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,10 @@ class Math implements ILib
{
public function register(Env $env): void
{
// Constants
$env->set('pi', \M_PI);
// Basic arithmetic
$env->set('+', new CoreFunc('+', 'Return the sum of all arguments.', 1, -1,

View File

@ -9,6 +9,8 @@ class Strings implements ILib
{
public function register(Env $env): void
{
$env->set('ln', \PHP_EOL);
$env->set('trim', new CoreFunc('trim', 'Remove whitespace from beginning and end of string.', 1, 1,
fn (string $a) => trim($a)
));