RE: [PHP] Functions ..why????
| From: | Dave VanAuken | Date: | Sun, 17 Dec 2000 13:21:25 +0000 |
| Subject: | RE: [PHP] Functions ..why???? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30732@lists.php.net to get a copy of this message | ||
if you are passing data to the function.
# If the function is doing something that doesn't require variables from
outside the function then deficing the function as:\
function doThis() {
blah blah blah;
}
# then we call it by
doThis();
# this is fine... but what if we wanted to doThis with some
# variables we just got from somewhere else, for example, remove
# all slashes from any variable we pass to the function:
function doThis($variableBeingPassed) {
$ReturnVariable=addslashes($variableBeingPassed);
return $ReturnVariable;
}
# we can now do the following:
$mySlashedVariable1=doThis($myUnslashedVariable1);
$mySlashedVariable2=doThis($myUnslashedVariable2);
# to add slashes to any variable we want
hope that makes sense
Dave
-----Original Message-----
From: Dhaval Desai [mailto:dhaval_adams@yahoo.com]
Sent: Sunday, December 17, 2000 7:37 AM
To: php-general@lists.php.net
Subject: [PHP] Functions ..why????
HI!
I have this little doubt..
can anybody explain me why do we use this type of
function:
function check_item($table, $session, $product) {
$query = "SELECT * FROM $table WHERE
session='$session' AND product='$product' ";
$result = mysql_query($query);
if(!$result) {
return 0;
AS far as I have seen..the funcations are like say for
example:
function dhaval()
{
echo "I am DHaval Dedai";
}
Please explain me why did we use thos things within
the brackets...while defining the function.
Thanx a lot!
Dhaval Desai
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net