function_exists php
        Posted  
        
            by 
                user527800
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user527800
        
        
        
        Published on 2010-12-28T10:51:01Z
        Indexed on 
            2010/12/28
            10:54 UTC
        
        
        Read the original article
        Hit count: 181
        
Hi all
I'm trying to write a function that could receive it's second arg a name of a function. In order to validate function's name (that will be used in an eval statement) I use function_exists such as:
if(function_exists($type)){
    $toEval= $type.'(\''.$file.'\');';
  }else{
But if the arg sent is include or require (with 'once' variations) this code fails (function_exists returns false).
How could this be fixed?
Thanks, Alex
© Stack Overflow or respective owner