array_diff weirdness


Posted on 16th Feb 2014 07:03 pm by admin

I'm using the following bit of code

$diff = array_diff($pids, $pidlist);
$diff = array_values($diff); //reindex array to remove empties
Did you know?Explore Trending and Topic pages for more stories like this.
//output to $discrepancy
print_r($diff);
exit;

Both $pids and $pidlist contain exactly the same value; so I would have expected that value not to appear in $diff - but it is. Both $pids and $pidlist contain a few thousand values, and I've only found this one example which appears in both lists as well as $diff.

Can anybody shed any light?
No comments posted yet

Your Answer:

Login to answer
216 Like 23 Dislike
Previous forums Next forums
Other forums

need good snippet manager
Hi. as i am coding and learning more, it is becoming difficult to manage code snippets. how you mana

Problem displaying "scraped" XML data
I'm basicly having trouble displaying XML data scraped from an URL using cURL.

What the code

Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<

defining website tags
Hi,

What would be the best way to define tags for my site, such as website title, url etc.

MySQL-PHP Query Results Help
Hello all. I'm hoping to be able to get some help in solving a problem with query/rowcount output. I

Time-based image rotation script
I'm trying to write a PHP script that rotates an image based on what time of day it is. I want the

Storing Values taken from a DB...
Using this code it will generate a short list from my database

<?php
mysql_connect

Count on multidimensional array
Hi, i got an array as below:

Array
(
=> Array
(

Problem with coding MySQL query
I'm having heaps of trouble getting one of my PHP/MySQL queries to work for some reason (and the fun

Multiple Dropdown Selections
I have a form that let's a user insert a page with the ability to select categories. I want them to

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash