Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array() Array() before every individual #21

Open
MattSlone opened this issue May 11, 2015 · 0 comments
Open

Array() Array() before every individual #21

MattSlone opened this issue May 11, 2015 · 0 comments

Comments

@MattSlone
Copy link

Hi, great library, it's been a lot of help! I'm not sure if this is where I put questions like this, if not I'll post it somewhere else.

For some reason though, I always have "Array() Array()" before every individual.

Here's my code:


spl_autoload_register(function ($class) {
    $pathToPhpGedcom = __DIR__ . '/plugins/'; // TODO FIXME

    if (!substr(ltrim($class, '\\'), 0, 7) == 'PhpGedcom\\') {
        return;
    }

    $class = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
    if (file_exists($pathToPhpGedcom . $class)) {
        require_once($pathToPhpGedcom . $class);
    }
});

$parser = new \PhpGedcom\Parser();
$gedcom = $parser->parse('sampleged.ged');

echo "<br /><br />";

foreach ($gedcom->getIndi() as $individual) {
    echo $individual->getId() . ': ' . current($individual->getName())->getSurn() .
        ', ' . current($individual->getName())->getGivn();
}
?>

And here's what I get:

Array ( [0] => Anakin /Skywalker/ ) Array ( [0] => Anakin ) Array ( [0] => Skywalker ) Array ( [0] => Padme /Amidala/ ) Array ( [0] => Padme ) Array ( [0] => Amidala ) Array ( [0] => Luke /Skywalker/ ) Array ( [0] => Luke ) Array ( [0] => Skywalker )

Array ( ) Array ( ) I1: Skywalker, AnakinArray ( ) Array ( ) I2: Amidala, PadmeArray ( ) Array ( ) I3: Skywalker, Luke


Also, is there a solution for removing this info:
Array ( [0] => Anakin /Skywalker/ ) Array ( [0] => Anakin ) Array ( [0] => Skywalker ) Array ( [0] => Padme /Amidala/ ) Array ( [0] => Padme ) Array ( [0] => Amidala ) Array ( [0] => Luke /Skywalker/ ) Array ( [0] => Luke ) Array ( [0] => Skywalker )

that appears at the top no matter what I change in the code it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant