lombax85 / create_function
A replacement for the function create_function for PHP 8
Installs: 653
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/lombax85/create_function
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2025-09-29 17:54:06 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