Hi Guys,
Here;s the simplified code:
<?php
class feeds
{
function __construct()
{
}
function process($data)
{
$db = db::getSingleton();
$map_fields = fields::getMapFields();
// INNER FUNCTION
function save($rows)
{
global $db, $map_fields;
foreach ($rows AS $row)
{
$db->save($row[$map_fields]])
}
return true;
}
Parser($data, 'save');
return true;
}
}
?>
So basically the "process" method calls a function called "Parser" which in turn calls the "save" function.
Works perfectly. Except:
The "$map_fields" valiable does not import into the scope of the "save" function BUT the "$db" variable does.
Anyone any adea why this is?
Is it because the "$map_fields" is in the scope of the "process" function? I would have thought the the "global" keyword refers to anything from it's current scope upwards?
Tricky... Any clues anyone?