Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

mpyw-junks/phpext-callee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callee

Provide recursion system for anonymous closures.

Requirements

PHP 7.x

Installing

Basic

mpyw@localhost:~$ git clone git@github.com:mpyw/phpext-callee.git
mpyw@localhost:~$ cd phpext-callee
mpyw@localhost:~/phpext-callee $ /path/to/phpize
mpyw@localhost:~/phpext-callee $ ./configure --enable-callee --with-php-config=/path/to/php-config --prefix=/path/to/php-src
mpyw@localhost:~/phpext-callee $ make
mpyw@localhost:~/phpext-callee $ make install
mpyw@localhost:~/phpext-callee $ vim /path/to/php.ini
mpyw@localhost:~$ phpbrew ext install git@github.com:mpyw/phpext-callee.git

Usage

<?php
var_dump((function ($n) {
    return $n < 2 ? 1 : $n * callee()($n - 1);
})(5));

// 5! = 5 * 4 * 3 * 2 * 1 = int(120)

About

Provide recursion system for anonymous closures.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published