Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function starts with & ???

Status
Not open for further replies.

vladibo

Programmer
Sep 14, 2003
161
CA
What does it mean if a function in an Object starts with & like

&query()?

Is it something special?
 
"&" is the PHP reference operator. A reference operator would make sence in terms of variable assignments. I don't know what it means in terms of simply invoking a function.

Take a look here:

Did you see "&" or "@" (ampersand)? Ampersand is the error-suppression operator:
Want the best answers? Ask the best questions: TANSTAAFL!!
 
I saw it in REAR classes, and especial in DB/Common.php

This is an example from this class:
/**
* This method is used to communicate an error and invoke error
* callbacks etc. Basically a wrapper for PEAR::raiseError
* without the message string.
*
* @param mixed integer error code, or a PEAR error object (all
* other parameters are ignored if this parameter is
* an object
*
* @param int error mode, see PEAR_Error docs
*
* @param mixed If error mode is PEAR_ERROR_TRIGGER, this is the
* error level (E_USER_NOTICE etc). If error mode is
* PEAR_ERROR_CALLBACK, this is the callback function,
* either as a function name, or as an array of an
* object and method name. For other error modes this
* parameter is ignored.
*
* @param string Extra debug information. Defaults to the last
* query and native error code.
*
* @param mixed Native error code, integer or string depending the
* backend.
*
* @return object a PEAR error object
*
* @access public
* @see PEAR_Error
*/
function &raiseError($code = DB_ERROR, $mode = null, $options = null,
$userinfo = null, $nativecode = null)
{
// The error is yet a DB error object
if (is_object($code)) {
// because we the static PEAR::raiseError, our global
// handler should be used if it is set
if ($mode === null && !empty($this->_default_error_mode)) {
$mode = $this->_default_error_mode;
$options = $this->_default_error_options;
}
return PEAR::raiseError($code, null, $mode, $options, null, null, true);
}

if ($userinfo === null) {
$userinfo = $this->last_query;
}

if ($nativecode) {
$userinfo .= " [nativecode=$nativecode]";
}

return PEAR::raiseError(null, $code, $mode, $options, $userinfo,
'DB_Error', true);
}


I know about variables and also about @ befor method (to suppres warnings) but this is something different
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top