Jump to content

callback functions in OOP


2levelsabove

Recommended Posts

I keep getting an error

 

The second argument, 'isoutgoing', should be a valid callback

 

 

 

I know how callbacks work in procedural but how do I call it in OOP

 

 

please help

 

 

 



function get_outgoing_links($uri){

	$uri = trim(eregi_replace('http://', '', $uri)); 
    $uri = trim(eregi_replace('http', '', $uri));
	$uri = trim(eregi_replace('www.', '', $uri));

$this->url=$uri;

$alllinks=explode(" ",$this->get_all_links($uri));


$outgoinglinksarray=array_filter($alllinks,"isoutgoing");


return $outgoinglinksarray;

}

//the call back function

function isoutgoing($link)
{
$link1 = parse_url($link);
   
   $cleanlink1=$link1['host'];
   
   
   		$$cleanlink1 = trim(eregi_replace('http://', '', $cleanlink1)); 
    $cleanlink1 = trim(eregi_replace('http', '', $cleanlink1));
	$cleanlink1 = trim(eregi_replace('www.', '', $cleanlink1));
   
   
  if ( !strpos($link1['host'], $this->$url))
  
  {
  return 1;
  }
   
   


}

Link to comment
https://forums.phpfreaks.com/topic/160738-callback-functions-in-oop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.