Re: put code into a function then the code dead,very strange.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2 August 2011 13:24, Sharl.Jimh.Tsin <amoiz.shine@xxxxxxxxx> wrote:
> 在 2011-08-02二的 22:29 +1200,Simon J Welsh写道:
>
>> You're using $motoCols in your function, but have not defined it or passed it as an argument.
>> ---
>> Simon Welsh
>> Admin of http://simon.geek.nz/
>>
>
> YES,thanks for taking me out.and i just have a question that the variety
> $motoCols has been defined with the function "processJSONtoSQL" together
> in the common.php which is imported into the main page at head.
>
> so WHY $motoCols can not be reachable by the function in one page?

It is to do with variable scope.

http://uk.php.net/manual/en/language.variables.scope.php /
http://uk.php.net/manual/zh/language.variables.scope.php

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux