View Single Post
Old 02-26-2013, 09:31 AM   PM User | #3
Pcfr43k
New Coder

 
Join Date: Jan 2010
Location: The Netherlands
Posts: 53
Thanks: 10
Thanked 0 Times in 0 Posts
Pcfr43k is an unknown quantity at this point
Quote:
Originally Posted by Arcticwarrio View Post
you could try 2 loops?

im not sure if [0] => Dummy page will be found as [1] => Dummy%20page

PHP Code:

foreach($menuxml as $k1 => $v1) {
    foreach(
$menufile as $k2 => $v2 {
        if (
$v1 $v2) {
                unset(
$menuxml[$k1]);
        }
    }

Well, it kinda worked. I changed the XML content in Dummy%20page, etc...
Put the ')' behind the first $v2, and it did run, but got out empty again.
I think this is happening:

Once 'Array( [0] => Dummy%20page%202' is coming in, is checks with the first child of $menuxml: Array( [0] => SimpleXMLElement Object( [0] => Start ), instead of the child of SimpleXMLElement Object.

So how do I get the child-child? Or am I wrong there?

Edit:
I rebuilded my $menuxml so it has the data as a direct child, and it still gets erased...
This is $menuxml at first:
Code:
Array
(
    [0] => Start
    [1] => Dummy%20page
    [2] => Dummy%20page%202
)
And after this:
PHP Code:
foreach($menuxml as $k1 => $v1) {
    foreach(
$menufile as $k2 => $v2) {
        if (
$v1 $v2) {
                unset(
$menuxml[$k1]);
        }
    }

It turns into this:
Code:
Array
(
)
What is going wrong?
Is it the id ([0], [1], etc...) that mismatches?

Last edited by Pcfr43k; 02-26-2013 at 09:58 AM.. Reason: Tried another way
Pcfr43k is offline   Reply With Quote