I'm working on an old PHP website, and Netbeans is complaining about an uninitialized variable. I'm seeing some code like this:
$app->soapAPIVersion($apiVersion);
$_SESSION['apiVersion'] = $apiVersion;
The function looks something like this:
function soapAPIVersion(&$apiVersion)
{
$apiVersion = '';
$result = false;
$soapResult = $client->call('getAPIVersion', array('sessionKey' => $sessionKey), $url);
if (is_string($soapResult))
{
$apiVersion = $soapResult;
$result = true;
}
return $result;
}
I believe it's using this line to initialize the $aviVersion variable:
$app->soapAPIVersion($apiVersion);
For better coding practice, should that really be this:
$apiVersion = '';
$app->soapAPIVersion($apiVersion);
Or is it a valid trick?