lombax85 / create_function
A replacement for the function create_function for PHP 8
1.0.3
2021-04-17 22:40 UTC
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2025-02-17 15:12:55 UTC
README
This repository contains a replacement for the function create_function
that has been removed from PHP 8
This is a first beta version with some limitations
Installation
composer require lombax85/create_function
Usage
// Simple function
$f = create_function('$a,$b', 'return $a+$b;');
echo $f(1,2); // prints 3
// pass by reference
$f = create_function('&$a', '$a++;');
$a = 1;
$f($a);
echo $a; // prints 2