Skip to main content
Inspiring
April 19, 2006
Question

Quick PHP Question

  • April 19, 2006
  • 2 replies
  • 309 views
SOrry about the simple ques.

I'm creating a function that already has a variable defined. Will I be
redefining this variable when I define my function and include it?

Example:

$varDate = Recordset

function priivaDate ($varDate) {
$varDate +1;
return $varDate;}

I'm guessing my answer is I'm all clear, but I just want to make sure.

--

Thanks,
Jon


This topic has been closed for replies.

2 replies

Inspiring
April 19, 2006
I had. I was using a recordset I had forgot to reset before use. (hence,
where I thought it was resetting the variable, it was simply out of info).
I was being an idiot. I've got it now. I was just checking to post back my
mistake, lol.

Thanks anyway, Micha!


Inspiring
April 19, 2006
.oO(crash)

>I'm creating a function that already has a variable defined. Will I be
>redefining this variable when I define my function and include it?
>
>Example:
>
>$varDate = Recordset
>
>function priivaDate ($varDate) {
> $varDate +1;
> return $varDate;}
>

Why not simply test it or look it up in the manual?

The second $varDate is only visible within the context of the function.
It won't affect the global variable, unless that one is imported into
the function using the 'global' keyword. From the manual:

| [...] However, within user-defined functions a local function scope is
| introduced. Any variable used inside a function is by default limited
| to the local function scope.

Micha