PHP has a map class: it is called SplObjectStorage . Access to it is possible using the same syntax as the general array (see Example # 2 for a link ).
But to use the class you have to use the ArrayObject class instead of arrays. It is processed just like arrays, and you can create instances from arrays (for example, $arrayObject = new ArrayObject($array) ).
If you do not want to use these classes, you can also just create a function that creates unique hash strings for your indexes. For instance:
function myHash($array){ return implode('|',$array); } $rowNumberByRow[myHash($array)] = $rowNumber;
Of course, you have to make sure that your hashes are really unique, and I highly recommend that you use SplObjectStorage and perhaps read a little more about php SPL classes.
source share