
create_function 함수는 PHP 7.2 부터는 사용할 수 없습니다. 하지만, PHP 7.2 이전 버전에서 사용할 수 있습니다.
create_function 함수는 변수를 사용할 수 있습니다. 예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$greeting = 'hello';
$hello = create_function('', 'echo $greeting;');
$hello();
이 코드는 'hello'를 출력합니다.
create_function 함수는 PHP 7.2 부터는 사용할 수 없습니다. PHP 7.2 이후 버전에서 함수를 정의할 때는 anonymous function을 사용해야 합니다.
#hostingforum.kr
php
$greeting = 'hello';
$hello = function() use ($greeting) {
echo $greeting;
};
$hello();
이 코드는 'hello'를 출력합니다.
create_function 함수를 사용할 때, 변수를 사용할 수 있습니다. 하지만, PHP 7.2 이후 버전에서 사용할 수 없습니다.
2025-03-20 00:56