Re: Variable Undefined, even when global?
| From: | Ernest E Vogelsinger | Date: | Sun, 09 Mar 2003 00:43:05 +0000 |
| Subject: | Re: Variable Undefined, even when global? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138801@lists.php.net to get a copy of this message | ||
At 01:28 09.03.2003, Ron Biggs said:
--------------------[snip]--------------------
>function ColorCollection($lkID){
>
> $whatX = $lkID + 1; // Adding 1 turns makes the index correspond to the
>template number.
>
>// $aColLen = count($lkColor); //.length
> $aColLen = test; //sizeof($lkColor); //.length
>
> echo "<option value=\"\" selected>xxx</option>\n"; //first
> option is blank
>
>// KeepGoing: //PHP does not have a line-label statement. Set up a trigger
> for($i=0;$i<$aColLen;$i++){
> $trigger = false;
> $whatglass = $lkColor[$i]->glass; //shouldn't $lkColor[any-number] be
>global??? <<<<<<<<<<<
--------------------[snip]--------------------
Yes it _is_ global, but within the function you need to declare if global
to have access to it, if you miss this you're referencing a local variable,
which is not defined...
function ColorCollection($lkID){
global $lkColor; //
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$whatX = $lkID + 1; // Adding 1 turns makes the index correspond to the
template number.
// $aColLen = count($lkColor); //.length
$aColLen = test; //sizeof($lkColor); //.length
echo "<option value=\"\" selected>xxx</option>\n"; //first option
is blank
// KeepGoing: //PHP does not have a line-label statement. Set up a trigger
for($i=0;$i<$aColLen;$i++){
$trigger = false;
$whatglass = $lkColor[$i]->glass; //shouldn't $lkColor[any-number] be
global???
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/