-2

I saw people helping on rewriting to anonymous function. But I really don't know how:

Deprecated: Function create_function() is deprecated in /mnt/web110/c3/68/51799968/htdocs/portfolio2017/wp-content/themes/clean-photo-wp-modified/internal/includes.php on line 149

Method:

/**
 * Safe file inclusion
 *
 * @param $path
 */
public static function include_isolated( $path ) {
    if ( ! self::$include_isolated_callable ) {
        self::$include_isolated_callable = create_function( '$path', 'include $path;' );
    }

    call_user_func( self::$include_isolated_callable, $path );
}
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87
  • `= function($path){include $path;};` – Dharman Jan 14 '19 at 21:04
  • I wonder what the purpose is though. If it was called statically, wrapping it in another local function scope doesn't hide much more for the included script. – mario Jan 14 '19 at 21:30

1 Answers1

2
self::$include_isolated_callable = function($path) { include $path; };

http://php.net/manual/en/functions.anonymous.php

msphn
  • 307
  • 2
  • 9