How to get data from multidimensional array by ommiting one column?

I am storing info in an array in a loop like that:

while ($ind = mysql_fetch_array($result))
    $array["uniqueName"][$ind][$hash]["mac"] = $mac;

How can I get all $mac's if I am not given $hash, so by all hashes in context:


What can I do with '?' above? Can I ommit that somehow?

Thank you.


you can loop over the hash keys like this:

$macs = array();
foreach($array["uniqueName"][$ind] as $hash){
    array_push($macs, $hash["mac"]);

Update from comment:

The foreach statement loads every key $array["uniqueName"][$id] contains into the $hash variable, one by one. So you don't have to know what these keys actually are (or even if there are any), you can just use them by referring to them using the $hash var. So in effect, that foreach statement loops over all keys $array["uniqueName"][$id] contains.

Need Your Help

Using Thread with paint java

java multithreading swing switch-statement event-dispatch-thread

I'm developing a checkers game in Java, and I stumbled on a problem.

Can using self-signed certificates with WCF be secure?

wcf security certificate wcf-security x509certificate

Imagine for a moment that we're using classic asymmetric encription with WCF (private/public key pairs). Obviously it's secure until private keys aren't stolen. We don't need any trust chains between

JQuery iterate through current SELECT values

javascript jquery select

how do you iterate through just the current values of all selects, not the options?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.