Before I waste time trying a bunch of different things, thought I'd ask here to see if anyone has a good strategy for this.
I have almost 3,000 arrays that are being produced in a while
loop. Perhaps also I'm thinking is valuable is that I can attach the ID
of the soon to be array
$results = $mysqli->query("SELECT ID, post_content
FROM wp_posts
WHERE post_type = 'product';");
while($row = $results->fetch_array()) {
$id2 = $row['ID'];
$id = mysqli_real_escape_string($mysqli, $id2);
It's important to note that when I say comparing these arrays I'm not looking to compare them based off their content, but rather the number of nodes in the array.
So I can of course do that easily
$arraycount = count($wp_post_array);
And thusly I can get the two things I need: the unique ID
and the count
of the array.
echo '<br />' . 'ID: ' . $id. '<br />';
echo '<br />' . 'ARRAY COUNT: ' . $arraycount . '<br />';
Giving me an output like this:
So, I think this is the first step. As I said I have around 3,000 of these, so manually trying to match these up is not something I want to do.
My output (just for the sake of the question - I don't really care what it is as long as I'm able to compare), would maybe look something like:
ARRAY COUNT: 55
ID: 5740, 8805, ..., etc
Anyone have any experience with doing something like this? I'm sure there would be an easy solution if I was working with 2 or 3 arrays, but in the case of thousands? I'm not sure what the smartest strategy would be. Is there a built-in PHP function that can help me, or a library, or just a smart idea to get these to compare the array count?
Edit:
Sample Array
Array
(
[0] => Arcu Magna Accessus 16-03 AB Class non Nunc Corrupti Elit Sit 4" Provocatus
[1] => 6" Superue Tibi Sit
[2] => 6380-0362
[3] => Quos Porro Oppressu EA
[4] => Leo id Louor & Quam Tibi Commune
[5] => Memoriam:
[6] => mE Magni Illa Harusen
[7] => eA Quos Elit Armorum
[8] => Responsuros Louor:
[9] => 939/07 Hac A/Lorem molfstum
[10] => Ex successum ex dominatio justo fortitudinis sed rem ornare hac hic successus li urna iucunda usus hac te nemo vulputate.
)
Which is beheld in a variable and then counted.