function with array variable

Posted by mtokoly on Stack Overflow See other posts from Stack Overflow or by mtokoly
Published on 2010-06-08T06:11:47Z Indexed on 2010/06/08 6:32 UTC
Read the original article Hit count: 282

Filed under:
|
|

How do I pass an array through a function, for example:

$data = array(
    'color'  => 'red',
    'height' => 'tall'
);

something($data);

function something($data) {
    if ($data['color'] == 'red') {
        // do something
    }
}  

how can I get the function to recognize $data[color] and $data[height]?

© Stack Overflow or respective owner

Related posts about php

Related posts about function