简体   繁体   中英

Can I use variable functions with language constructs?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM