hello am still learning php and trying to call php function by url link and i did found this code
if(function_exists($_GET['f'])) {
$_GET['f']();
}
but it's not safe for my function so i did something like that
if($_GET['f']=='mouner'){
function mouner(){
$s = 'my name is mouner';
return($s);
}
echo mouner();
}
is that safe code ? and if it's not what is the best way to call function by url with no security risk
echoto your statement when calling afunctionin php..!function mouner() { }inside youriffunction as you may know that way you are declaring the function as local which you may not be able to call to in somewhere else outside your this if function..!if (function_exists($_GET['f']))asif (isset($_GET['f']))I do know but not yours one..!echo 'my name is mouner';inside your if and it would be exactly equivalent.