Possible Duplicate:
Can’t use method return value in write context
What is the way to add a if statement in Simple HTML dom parser( http://simplehtmldom.sourceforge.net/ ) function
Have a look at my script
include ('dom.php');
$check = file_get_html("http://www.google.com");
if(empty($check->find('div[id=domain]',0))){$same="NoData";} // line 3
else { $same = $check->find('div[id=domain]',0); }
Have a look at line 3! Here i want to add a if statement to check is there any div with the 'domain' attribute id at my targeted page! so, if it is empty that means that it has no div with the 'domain' attribute id so it should store NoData
in $same
variable. and if there is a div with the 'domain' attribute id then it will fetch the and store the name in $same
variable. But // line 3
showing an ugly error!
Error: Fatal error: Can't use method return value in write context in C:\UwAmp\phpapps\uwamp\php\code.php on line 5
Any idea?