src/sb/PDO.php
public static function paramify($data, $omit=Array())
    {

        $params = Array();

        if(is_object($data)){
            $data = get_object_vars($data);
        }

        if(is_array($data)){
            foreach($data as $key=>$val){
                if(!in_array($key, $omit)){
                    $params[':'.$key] = $val;
                }
            }
        }

        return $params;
    }
public static function paramify($data, $omit=Array())
    {

        $params = Array();

        if(is_object($data)){
            $data = get_object_vars($data);
        }

        if(is_array($data)){
            foreach($data as $key=>$val){
                if(!in_array($key, $omit)){
                    $params[':'.$key] = $val;
                }
            }
        }

        return $params;
    }
public static function paramify ( $ data , $ omit = Array ( ) ) { $ params = Array ( ) ; if ( is_object ( $ data ) ) { $ data = get_object_vars ( $ data ) ; } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ val ) { if ( ! in_array ( $ key , $ omit ) ) { $ params [ ':' . $ key ] = $ val ; } } } return $ params ; }
Converts an array into a bound params hash

@param array/object $data The object/hash to convert to a bindParams compatible hash with the colon in front of each key so that it can be used as a bid param array
@param array $omit An simple array of key names to omit from the array
@return array The input data as an array designed for passing to pdo's execute or bindParams
@author paul.visco@roswellpark.org
@version 1.0
<code>
$question = new Question();
$question->qid = 1;
$question->answer = 'grape';

$params = \sb\PDO::paramify($question);
//returns $params as Array ( [:qid] => 1 [:answer] => 'grape' )

$params = \sb\PDO::paramify(Array('qid' => 1, 'answer' => 'grape'));
//returns $params as Array ( [:qid] => 1 [:answer] => 'grape' )
</code>
Converts an array into a bound params hash