Can I use variable functions with language constructs?

106 Views Asked by At

This question here kinda address the issue. In my case I would like to call a function like empty() or is_int(). For example:

<?php

    $foo = 'empty';
    $test = NULL;
    $foo($test);

This question is not a duplicate of:

How to call PHP function from string stored in a Variable

My question addresses a native PHP function not a user made function.

1

There are 1 best solutions below

0
Rizier123 On BEST ANSWER

Variable function doesn't work with language constructs as you can read in the manual:

Variable functions won't work with language constructs such as echo, print, unset(), isset(), empty(), include, require and the like. Utilize wrapper functions to make use of any of these constructs as variable functions.