Thanks, you guys rock! :)

Girish

----- Original Message -----
From: "Roberto Ramírez" <[EMAIL PROTECTED]>
To: "Girish Nath" <[EMAIL PROTECTED]>
Sent: Thursday, November 22, 2001 4:10 PM
Subject: RE: [PHP] What does &var mean ?


The use of the & means that its passed by reference.

That its equal to the memory address of where the variable is stored

&$variable

its often used to modify the value of a that variable within a function.

for example:

<?php

$variable = 3;
echo $variable;
#will print 3

function checkit(&$x){
$x = 5;
#this will modify the value of $variable.
}

checkit($variable);

echo $variable;
#will print 5
?>
________________________________________________
PROSSES, Roberto Ramírez.

Tel-Fax. 8115 3197 y 99
Puerto No. 3425 Col. Riberas del Río CP. 67160 Guadalupe, Nuevo León.
México.

Visítanos aquí:        http://www.prosses.com
<http://www.prosses.com> Correo electrónico:  [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>



-----Mensaje original-----
De: Girish Nath [mailto:[EMAIL PROTECTED]]
Enviado el: Jueves, 22 de Noviembre de 2001 09:43 a.m.
Para: [EMAIL PROTECTED]
Asunto: [PHP] What does &var mean ?


Hi

I've been looking at some classes an have come across this notation for
example :

function remove(&$productid) {
/* this function will remove a given product from the cart */
    if (isset($productid)) {
    unset($this->items[$productid]);
    }
}


What does the "&" (ampersand) before the variable name mean ?

Thanks


Girish


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to