array_diff

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

array_diff

Post by alex.barylski »

I have two arrays which I want checked, both when passed to print_r() return:

Code: Select all

Array ( [0] => fname [1] => lname [2] => time ) 
Array ( [0] => fname [1] => lname [2] => time )
Identical in everyway...

but when I pass both arrays to array_diff() I get this:

Code: Select all

Array ( [1] => lname [2] => time )
WTF...

If both arrays are identical...should this function return an array of ZERO length???

What the hell am I missing...?

Code: Select all

print_r(array_diff($arr1, $arr2));
Cheers :)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Nevermind, I figured it out :oops:

Damn whitespace...drives me nutts :)
Post Reply