Re: Variable Undefined, even when global?
| From: | Ron Biggs | Date: | Sun, 09 Mar 2003 00:53:52 +0000 |
| Subject: | Re: Variable Undefined, even when global? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138808@lists.php.net to get a copy of this message | ||
You are a god among men, Ernest. THANK YOU!
-ron
"Ernest E Vogelsinger" <ernest@vogelsinger.at> wrote in message
news:5.1.1.6.2.20030309014055.031e93a8@mail.vogelsinger.at...
> 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/
>
>