lombax85/create_function

A replacement for the function create_function for PHP 8

1.0.3 2021-04-17 22:40 UTC

This package is not auto-updated.

Last update: 2024-04-29 11:26:29 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