Jump to content

Can't use function return value in write context


bazianm

Recommended Posts

Hi,

 

I am kind of new to php (although an experienced programmer in other languages). I am working on an application and I have a problem which I have been unable to figure out. I have googled it and still cannot get a handle on it. I have boiled it down to a simple example. Here's the code:

 

<?php

$array = gettest();

foreach ($array as $item)
{
if(gettype($item) == 'NULL') echo '<H1>WOW! A NULL!</H1>';
echo gettype($item).'<br>';
}


function gettest(){
$lcFilter = "1|2|3";
$laFilter = explode('|',$lcFilter);

if(!empty(laFilter(0))) laReturn('jobid') = laFilter(0);
if(!empty(laFilter(1))) laReturn('stateid') = laFilter(1);
if(!empty(laFilter(2))) laReturn('storeid') = laFilter(2);

return $laReturn;
}
?>

 

When I run this, the line:

 

	if(!empty(laFilter(0))) laReturn('jobid') = laFilter(0);

 

generates the error:

 

Fatal error: Can't use function return value in write context in C:\xampp\htdocs\test.php on line 16

 

I cannot think of what is wrong with the code. It seems simple enough. Any assistance would be greatly appreciated.

 

Thanks

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.