By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

newby question : function parameter passing

P: n/a
Help. I'm new to php. I wrote a function that did not seem to work so
I checked whether the parameter I was passing to the function was
actually being used. I found that it wasn't. When I run the following
code I get:

Testcheck:

and nothing else. It seems that the variable is not being passed to
the function. Here is the code:

function file_write_position($textcheck) {
print "Testcheck: " . $testcheck . "<br>\n\n";
return;
}

$testcheck="# Test Call Area";
file_write_position($testcheck);

What am I doing wrong??

A

Feb 26 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
amadain schrieb:
Help. I'm new to php. I wrote a function that did not seem to work so
I checked whether the parameter I was passing to the function was
actually being used. I found that it wasn't. When I run the following
code I get:

Testcheck:

and nothing else. It seems that the variable is not being passed to
the function. Here is the code:

function file_write_position($textcheck) {
print "Testcheck: " . $testcheck . "<br>\n\n";
return;
}

$testcheck="# Test Call Area";
file_write_position($testcheck);

What am I doing wrong??

A
The parameter is called $textcheck, but you are using $testcheck inside
the function.
Feb 26 '07 #2

P: n/a
>
The parameter is called $textcheck, but you are using $testcheck inside
the function.
That's funny! Also, you don't need to include the return statement
unless you are returning something.

Feb 26 '07 #3

P: n/a
..oO(amadain)
>Help. I'm new to php. I wrote a function that did not seem to work so
I checked whether the parameter I was passing to the function was
actually being used. I found that it wasn't. [...]
Set error_reporting to E_ALL in your php.ini.

Micha
Feb 26 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.