To call a method by dynamic name you can do this:
$methodName="MyMethod";
$result=$methodName();
To create a class by dynamic name you can do this:
$className="MyClass";
$classVar=new $className;
To call any method by dynamic name in previously initialized class you can do this:
$methodName="MyMethod";
$result=$classVar->$methodName();
function IsGooglebot(){
if(eregi("Googlebot",$_SERVER['HTTP_USER_AGENT'])){
$ip = $_SERVER['REMOTE_ADDR'];
$name = gethostbyaddr($ip);
if(eregi("Googlebot",$name)){
$hosts = gethostbynamel($name);
foreach($hosts as $host){
if ($host == $ip){
return true;
}
}
return false; }else{
return false; }
}else{
}
return false;
}
Did some tests and found out that scripts of type
$a=5;
function foo(){
global $a;
return $a +5;
}
foo();
have relatively bad performance ….
try to use something like
$a=5;
function foo($a){
return $a +5;
}
foo($a);
instead …