private function parse(&$params, &$query) {

		//Check the type of param binding ("?" = all keys are numeric or ":" = all keys are strings)
	 	if(0 !== count(array_filter(array_keys($params), 'is_string'))) {
			
			preg_match_all('#:((?:[a-zA-Z_])(?:[a-zA-Z0-9-_]+)?)#', $query, $variables);

			if(true === isset($variables[0])) {

				$parameters = [];

				foreach($variables[0] as $index => $variable) {
					
					if(false === array_key_exists($variables[1][$index], $params)) {
						return trigger_error(sprintf('Parameter "%s" missing from bind parameters', $variables[1][$index]), E_USER_ERROR);
					}
					
					$parameters[] =& $params[$variables[1][$index]];
					$query = str_replace($variables[0][$index], '?', $query);
				}

				$params = $parameters;
			}
	 	}

		$bind = [];

		if(count($params) > 0) {

			$types = '';

			foreach($params as $param => $value) {

				switch(gettype($value)) {
		            
		            case 'NULL'		:
		            case 'string'	: $types .= 's'; break;

		            case 'boolean'	:
		            case 'integer'	: $types .= 'i'; break;
		            
		            case 'blob'		: $types .= 'b'; break;
		            
		            case 'double'	: $types .= 'd'; break;
		        }
			}

			$bind[] =& $types;

			foreach($params as $param => $value) {
				$bind[] =& $params[$param];
			}
		}

		return $bind;
	}
private function parse(&$params, &$query) {

		//Check the type of param binding ("?" = all keys are numeric or ":" = all keys are strings)
	 	if(0 !== count(array_filter(array_keys($params), 'is_string'))) {
			
			preg_match_all('#:((?:[a-zA-Z_])(?:[a-zA-Z0-9-_]+)?)#', $query, $variables);

			if(true === isset($variables[0])) {

				$parameters = [];

				foreach($variables[0] as $index => $variable) {
					
					if(false === array_key_exists($variables[1][$index], $params)) {
						return trigger_error(sprintf('Parameter "%s" missing from bind parameters', $variables[1][$index]), E_USER_ERROR);
					}
					
					$parameters[] =& $params[$variables[1][$index]];
					$query = str_replace($variables[0][$index], '?', $query);
				}

				$params = $parameters;
			}
	 	}

		$bind = [];

		if(count($params) > 0) {

			$types = '';

			foreach($params as $param => $value) {

				switch(gettype($value)) {
		            
		            case 'NULL'		:
		            case 'string'	: $types .= 's'; break;

		            case 'boolean'	:
		            case 'integer'	: $types .= 'i'; break;
		            
		            case 'blob'		: $types .= 'b'; break;
		            
		            case 'double'	: $types .= 'd'; break;
		        }
			}

			$bind[] =& $types;

			foreach($params as $param => $value) {
				$bind[] =& $params[$param];
			}
		}

		return $bind;
	}
private function parse ( & $ params , & $ query ) { //Check the type of param binding ("?" = all keys are numeric or ":" = all keys are strings)
 if ( 0 !== count ( array_filter ( array_keys ( $ params ) , 'is_string' ) ) ) { preg_match_all ( '#:((?:[a-zA-Z_])(?:[a-zA-Z0-9-_]+)?)#' , $ query , $ variables ) ; if ( true === isset ( $ variables [ 0 ] ) ) { $ parameters = [ ] ; foreach ( $ variables [ 0 ] as $ index => $ variable ) { if ( false === array_key_exists ( $ variables [ 1 ] [ $ index ] , $ params ) ) { return trigger_error ( sprintf ( 'Parameter "%s" missing from bind parameters' , $ variables [ 1 ] [ $ index ] ) , E_USER_ERROR ) ; } $ parameters [ ] = & $ params [ $ variables [ 1 ] [ $ index ] ] ; $ query = str_replace ( $ variables [ 0 ] [ $ index ] , '?' , $ query ) ; } $ params = $ parameters ; } } $ bind = [ ] ; if ( count ( $ params ) > 0 ) { $ types = '' ; foreach ( $ params as $ param => $ value ) { switch ( gettype ( $ value ) ) { case 'NULL' : case 'string' : $ types .= 's' ; break ; case 'boolean' : case 'integer' : $ types .= 'i' ; break ; case 'blob' : $ types .= 'b' ; break ; case 'double' : $ types .= 'd' ; break ; } } $ bind [ ] = & $ types ; foreach ( $ params as $ param => $ value ) { $ bind [ ] = & $ params [ $ param ] ; } } return $ bind ; }
Parse parameters and return it with types
@param array $params
@param string $query
@return array
Parse parameters and return it with types