I'm newbie to PHP and I have a simple question.
UPDATE: I am using PHP 5.6 (Best solution would be to update the PHP version but let's suppose that I can only use PHP 5.6)
I have a code like below:
function findOrCreateMasterRecord ($masterTableName, $masterName) {
if (isset($sampleArr[$masterTableName][$masterName])) {
return $sampleArr[$masterTableName][$masterName];
}
return getNewMasterIndex($masterTableName, $masterName);
}
This code works properly. But I want to make "if" block more simple because it approaches twice to same index($sampleArr[$masterTableName][$masterName]) and I think this is...somewhat..not good.
Is there a way to make this function to be more effective?
Thank you.