zmienna funkcyjna

0
function name($fun)
{
	if($$fun($_GET['ss'])) return 'tak';
}

$fun - isset lub empty

dlaczego powyższy kod nie działa?

Fatal error: Function name must be a string in ...

0

Jak tę funkcję wywołujesz?

0

A w manualu poszukał?
http://us3.php.net/manual/en/functions.variable-functions.php

function name($fun)
{
        if($fun($_GET['ss'])) return 'tak';
}

Tak powinno działać

0

Sarrus, sek w tym ze nie dziala

Fatal error: Call to undefined function isset()

$zm = name('isset');

0
dokumentacja isset napisał(a)

Note: Because this is a language construct and not a function, it cannot be called using variable functions.

tak samo echo, print, unset, empty, include i require - to nie są funkcje (mimo że wyglądają podobnie) tylko konstrukcje języka i nie możesz ich tak wywoływać
musisz je najpierw "opakować" w funkcję

1 użytkowników online, w tym zalogowanych: 0, gości: 1