Skip to content
Advertisement

Random Unique IDs for Secret Santa/Kris Kindle

I gat a database table, which filed in with names and unique EntryIDs.

My goal is to Match every unique EntryID to another Unique EntryID.

I all ready tried this post here but it doesn’t work for that what I want.

Here is my code:

JavaScript

But all I get is for example: Array ( [1] => 3 [2] => 4 [3] => [4] => 2 )

But this have an empty array spot in it or I get Following Error:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in C:xampphtdocsWichtelnindex.php on line 43

What I expected (example): Array ( [1] => 3 [2] => 4 [3] => 1 [4] => 2 ) or Array ( [1] => 4 [2] => 1 [3] => 2 [4] => 3 ) Something like that.

What have I done wrong here?

Advertisement

Answer

I gat it.

Some times PHP is a bi*** xD

JavaScript

Here is the resault:

JavaScript

No duplicates like [0] => 0 or 1 => 1

Works fine now.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement